Skip to content

Commit 673a6f9

Browse files
committed
Fix overflow bug when creating the absolute value
Previously, the tests failed on some platforms due to it.
1 parent 6047cdf commit 673a6f9

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/int/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ macro_rules! int_impl {
6363

6464
fn extract_sign(self) -> (bool, $uty) {
6565
if self < 0 {
66-
(true, !(self as $uty) + 1)
66+
(true, (!(self as $uty)).wrapping_add(1))
6767
} else {
6868
(false, self as $uty)
6969
}

0 commit comments

Comments
 (0)