Merge pull request #736 from tgross35/fix-abs-diff

Fix a bug in `abs_diff`
This commit is contained in:
Trevor Gross 2024-12-22 17:25:43 -05:00 committed by GitHub
commit cd4b4a6cbf
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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);
@ -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);