mirror of
https://github.com/allankoechke/rust.git
synced 2026-12-05 17:36:20 +00:00
Merge pull request rust-lang/libm#366 from tgross35/fix-abs-diff
Fix a bug in `abs_diff`
This commit is contained in:
@@ -184,7 +184,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);
|
||||
@@ -221,7 +221,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);
|
||||
|
||||
Reference in New Issue
Block a user