Skip to content
This repository was archived by the owner on Apr 28, 2025. It is now read-only.

Commit 78a9394

Browse files
authored
Merge pull request #366 from tgross35/fix-abs-diff
Fix a bug in `abs_diff`
2 parents eb6d696 + 658a32d commit 78a9394

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

libm/src/math/support/int_traits.rs

Lines changed: 2 additions & 2 deletions
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)