-
Notifications
You must be signed in to change notification settings - Fork 48
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
feature: more Shl+Shr impls #328
Conversation
dad200a
to
95dc182
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good w me, simple enough
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #328 +/- ##
==========================================
- Coverage 80.78% 80.45% -0.34%
==========================================
Files 54 54
Lines 6111 6053 -58
==========================================
- Hits 4937 4870 -67
- Misses 1174 1183 +9
☔ View full report in Codecov by Sentry. |
src/bits.rs
Outdated
self.wrapping_shr(*rhs) | ||
} | ||
} | ||
impl_shift!(usize, u8, u16, u32, i8, i16, i32, isize); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
u64
/i64
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good w/ me! pending dani's nit
// Only when losslessy castable to usize. | ||
#[cfg(target_pointer_width = "64")] | ||
impl_shift!(u64, i64); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
below is lossless too, it just pads
Motivation
Closes #327
Solution
Add Shl and Shr implementations for types that are losslessly castable to usize by re-using the existing
usize
implementationPR Checklist