Skip to content

Commit

Permalink
Manually format functions and use rhs instead of v from my CE tes…
Browse files Browse the repository at this point in the history
…ting
  • Loading branch information
chorman0773 committed Aug 21, 2024
1 parent 700af56 commit 5f8cf71
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 17 deletions.
18 changes: 9 additions & 9 deletions core/src/num/int_macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1329,11 +1329,11 @@ macro_rules! int_impl {
#[must_use = "this returns the result of the operation, \
without modifying the original"]
#[inline]
pub const fn unbounded_shl(self, v: u32) -> $SelfT{
if v < Self::BITS{
pub const fn unbounded_shl(self, rhs: u32) -> $SelfT{
if rhs < Self::BITS{
// SAFETY:
// v is just checked to be in-range above
unsafe{self.unchecked_shl(v)}
// rhs is just checked to be in-range above
unsafe { self.unchecked_shl(rhs) }
}else{
0
}
Expand Down Expand Up @@ -1456,17 +1456,17 @@ macro_rules! int_impl {
#[must_use = "this returns the result of the operation, \
without modifying the original"]
#[inline]
pub const fn unbounded_shr(self, v: u32) -> $SelfT{
if v < Self::BITS{
pub const fn unbounded_shr(self, rhs: u32) -> $SelfT{
if rhs < Self::BITS{
// SAFETY:
// v is just checked to be in-range above
unsafe{self.unchecked_shr(v)}
// rhs is just checked to be in-range above
unsafe { self.unchecked_shr(rhs) }
}else{
// A shift by `Self::BITS-1` suffices for signed integers, because the sign bit is copied for each of the shifted bits.

// SAFETY:
// `Self::BITS-1` is guaranteed to be less than `Self::BITS`
unsafe{self.unchecked_shr(Self::BITS - 1)}
unsafe { self.unchecked_shr(Self::BITS - 1) }
}
}

Expand Down
16 changes: 8 additions & 8 deletions core/src/num/uint_macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1518,11 +1518,11 @@ macro_rules! uint_impl {
#[must_use = "this returns the result of the operation, \
without modifying the original"]
#[inline]
pub const fn unbounded_shl(self, v: u32) -> $SelfT{
if v < Self::BITS{
pub const fn unbounded_shl(self, rhs: u32) -> $SelfT{
if rhs < Self::BITS{
// SAFETY:
// v is just checked to be in-range above
unsafe{self.unchecked_shl(v)}
// rhs is just checked to be in-range above
unsafe { self.unchecked_shl(rhs) }
}else{
0
}
Expand Down Expand Up @@ -1643,11 +1643,11 @@ macro_rules! uint_impl {
#[must_use = "this returns the result of the operation, \
without modifying the original"]
#[inline]
pub const fn unbounded_shr(self, v: u32) -> $SelfT{
if v < Self::BITS{
pub const fn unbounded_shr(self, rhs: u32) -> $SelfT{
if rhs < Self::BITS{
// SAFETY:
// v is just checked to be in-range above
unsafe{self.unchecked_shr(v)}
// rhs is just checked to be in-range above
unsafe { self.unchecked_shr(rhs) }
}else{
0
}
Expand Down

0 comments on commit 5f8cf71

Please sign in to comment.