10

Github Add saturating abs/neg by workingjubilee · Pull Request #87 · rust-lang/s...

 3 years ago
source link: https://github.com/rust-lang/stdsimd/pull/87
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

New issue

Add saturating abs/neg #87

Merged

Conversation

Copy link

Contributor

workingjubilee commented 8 days ago

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

Copy link

Contributor

Lokathor commented 8 days ago

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?

Copy link

Contributor

Author

workingjubilee commented 8 days ago

edited

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

merged commit 4e6d440 into master 8 days ago

42 of 43 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Assignees

No one assigned

Labels
None yet
Projects

None yet

Milestone

No milestone

Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK