Skip to content

Commit

Permalink
don't special-case 0 when shifting
Browse files Browse the repository at this point in the history
  • Loading branch information
RalfJung committed May 15, 2024
1 parent 6eeccb8 commit 5087b70
Showing 1 changed file with 0 additions and 8 deletions.
8 changes: 0 additions & 8 deletions libspecr/src/int/ops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,6 @@ impl<T: Into<Int>> RemAssign<T> for Int {
impl<T: Into<Int>> Shl<T> for Int {
type Output = Self;
fn shl(self, other: T) -> Self {
if self == 0 {
return self;
}

let i = other.into().into_inner().to_i128().unwrap();
Self::wrap(self.into_inner() << i)
}
Expand All @@ -111,10 +107,6 @@ impl<T: Into<Int>> ShlAssign<T> for Int {
impl<T: Into<Int>> Shr<T> for Int {
type Output = Self;
fn shr(self, other: T) -> Self {
if self == 0 {
return self;
}

let i = other.into().into_inner().to_i128().unwrap();
Self::wrap(self.into_inner() >> i)
}
Expand Down

0 comments on commit 5087b70

Please sign in to comment.