You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For most such things, it's just because nobody needed it yet.
However, note that shifting is a bit weird compared to other checked/overflowing/wrapping ops, because overflowing_shl and overflowing_shr will overflow the shift value, not the result. Is that what you're actually looking for?
I am aware of overflowing_shl behavior in Rust. I personally need behavior, where shifting left too far results in zero (like in old x86 shl instructions).
And the thing is, this:
let(res, ok) = 1usize.overflowing_shl(n);
res *(!ok asusize)
I have need in
overflowing_shl
. Is there a reason, why there is no trait for it?P.S. Well, actually I need something like
saturating_shl
, but since there is no such thing in Rust,overflowing_shl
is the closest one.The text was updated successfully, but these errors were encountered: