Skip to content

Commit 145dbc4

Browse files
authored
Merge pull request rust-lang#366 from tgross35/fix-abs-diff
Fix a bug in `abs_diff`
2 parents 81f2dc6 + e9782ce commit 145dbc4

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/math/support/int_traits.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ macro_rules! int_impl {
184184
}
185185

186186
fn abs_diff(self, other: Self) -> Self {
187-
if self < other { other.wrapping_sub(self) } else { self.wrapping_sub(other) }
187+
self.abs_diff(other)
188188
}
189189

190190
int_impl_common!($uty);
@@ -221,7 +221,7 @@ macro_rules! int_impl {
221221
}
222222

223223
fn abs_diff(self, other: Self) -> $uty {
224-
self.wrapping_sub(other).wrapping_abs() as $uty
224+
self.abs_diff(other)
225225
}
226226

227227
int_impl_common!($ity);

0 commit comments

Comments
 (0)