Skip to content

Commit 3e0fe12

Browse files
authored
Merge pull request #736 from tgross35/fix-abs-diff
Fix a bug in `abs_diff`
2 parents a09218f + 36deaed commit 3e0fe12

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

src/int/mod.rs

+2-6
Original file line numberDiff line numberDiff line change
@@ -240,11 +240,7 @@ macro_rules! int_impl {
240240
}
241241

242242
fn abs_diff(self, other: Self) -> Self {
243-
if self < other {
244-
other.wrapping_sub(self)
245-
} else {
246-
self.wrapping_sub(other)
247-
}
243+
self.abs_diff(other)
248244
}
249245

250246
int_impl_common!($uty);
@@ -277,7 +273,7 @@ macro_rules! int_impl {
277273
}
278274

279275
fn abs_diff(self, other: Self) -> $uty {
280-
self.wrapping_sub(other).wrapping_abs() as $uty
276+
self.abs_diff(other)
281277
}
282278

283279
int_impl_common!($ity);

0 commit comments

Comments
 (0)