Skip to content

Commit

Permalink
Merge pull request #736 from tgross35/fix-abs-diff
Browse files Browse the repository at this point in the history
Fix a bug in `abs_diff`
  • Loading branch information
tgross35 authored Dec 22, 2024
2 parents a09218f + 36deaed commit 3e0fe12
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions src/int/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -240,11 +240,7 @@ macro_rules! int_impl {
}

fn abs_diff(self, other: Self) -> Self {
if self < other {
other.wrapping_sub(self)
} else {
self.wrapping_sub(other)
}
self.abs_diff(other)
}

int_impl_common!($uty);
Expand Down Expand Up @@ -277,7 +273,7 @@ macro_rules! int_impl {
}

fn abs_diff(self, other: Self) -> $uty {
self.wrapping_sub(other).wrapping_abs() as $uty
self.abs_diff(other)
}

int_impl_common!($ity);
Expand Down

0 comments on commit 3e0fe12

Please sign in to comment.