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

Should we have a saturating shift function? #2402

Open
larseggert opened this issue Feb 2, 2025 · 3 comments
Open

Should we have a saturating shift function? #2402

larseggert opened this issue Feb 2, 2025 · 3 comments
Labels
help wanted Extra attention is needed

Comments

@larseggert
Copy link
Collaborator

This seems good. Should we have a saturating shift function? This isn't the first time we've needed this sort of thing.

Originally posted by @martinthomson in #2294 (comment)

@mxinden
Copy link
Collaborator

mxinden commented Feb 2, 2025

Until https://doc.rust-lang.org/beta/std/num/struct.Saturating.html#method.rotate_left is stable, we might as well just copy the implementation.

@mxinden mxinden added the help wanted Extra attention is needed label Feb 2, 2025
@martinthomson
Copy link
Member

Rotation isn't what we want. The code we'd need is here: https://doc.rust-lang.org/beta/src/core/num/saturating.rs.html#82 (commented out with a big question about what it means). Perhaps we can provide some useful input to that discussion.

@martinthomson
Copy link
Member

I've commented on rust-lang/rust#103440, which covers the language enhancements.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants