Skip to content
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

Add saturating abs/neg #87

Merged
merged 2 commits into from
Apr 2, 2021
Merged

Add saturating abs/neg #87

merged 2 commits into from
Apr 2, 2021

Conversation

workingjubilee
Copy link
Contributor

Simple branchless software implementations for saturating abs/neg, for all the people using them on vectors that might contain i{N}::MIN.

@Lokathor
Copy link
Contributor

Lokathor commented Apr 2, 2021

i don't even know what saturating abs and neg do.

can the docs have like, a words description without needing to puzzle out the code sample?

@workingjubilee
Copy link
Contributor Author

workingjubilee commented Apr 2, 2021

Added.
For every signed integer the lowest value is greater than the highest value, so if you do abs() you overflow and get the minimum number back again in Rust (in other langs you get undef!).

@calebzulawski calebzulawski merged commit 4e6d440 into master Apr 2, 2021
@workingjubilee workingjubilee deleted the feat/sat-abs-neg branch April 14, 2021 02:54
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 this pull request may close these issues.

None yet

3 participants