-
Notifications
You must be signed in to change notification settings - Fork 143
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
All bit twiddling functions in num::traits::PrimInt should take or return usize instead of u32 #80
Comments
The problem is that the methods on primitive types like Maybe it would be better to require |
I've implemented this and some other bit wise algorithms in PrimInt. |
I think changing the trait bounds to |
add preserve_order feature
This issue was moved to rust-num/num-traits#14 |
The trait
num::traits::PrimInt
mandates that any type implementing it must also implementShl<usize, Output=Self>
andShr<usize, Output=Self>
(in other words,PrimInt
mandates that the shift amount be of typeusize
).Thus all bit twiddling functions (
trailing_zeros
,rotate_left
,count_zeros
etc.) inPrimInt
should take or return ausize
instead ofu32
as the number of bits for the sake of consistency with what the implementation restrictions onShl
andShr
mandate.The text was updated successfully, but these errors were encountered: