Skip to content

clean up round_from_int and to_int_unchecked after #232 #233

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
programmerjake opened this issue Jan 27, 2022 · 4 comments · Fixed by #236
Closed

clean up round_from_int and to_int_unchecked after #232 #233

programmerjake opened this issue Jan 27, 2022 · 4 comments · Fixed by #236

Comments

@programmerjake
Copy link
Member

you could remove round_from_int afaict because it's functionality is completely supplanted by cast

also to_int_unchecked should be generic over return type

Originally posted by @programmerjake in #232 (comment)

@programmerjake
Copy link
Member Author

Yes, I was thinking "hm, do I want to touch fn round_from_int?" but then I realized I didn't have a good vibe anymore for how strong the consensus was around fn round_from_int and fn to_int_unchecked, so I was going to bring that up at our next sync.

Originally posted by @workingjubilee in #232 (comment)

@andy-thomason
Copy link

I had to add a round_to_uint for bit twiddling of exponents in my branch.

If cast covers this, I'll change it.

@workingjubilee
Copy link
Member

workingjubilee commented Feb 4, 2022

Probably! Simd::cast is effectively a lanewise version of Rust's as, which means that for floats, it does a saturating conversion to the integer. Sight unseen, you may want to, for peeling out data from a float like the exponent, use Simd<f32>::{from,to}_bits instead.

@andy-thomason
Copy link

That is great as I'm translating scalar expressions to SIMD. Having something which is directly like as would be ideal.

The code is quite crude at the moment, but does produce a working translation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants