Fix overflow bug when creating the absolute value
Previously, the tests failed on some platforms due to it.
This commit is contained in:
parent
6047cdf1e8
commit
673a6f9948
|
@ -63,7 +63,7 @@ macro_rules! int_impl {
|
||||||
|
|
||||||
fn extract_sign(self) -> (bool, $uty) {
|
fn extract_sign(self) -> (bool, $uty) {
|
||||||
if self < 0 {
|
if self < 0 {
|
||||||
(true, !(self as $uty) + 1)
|
(true, (!(self as $uty)).wrapping_add(1))
|
||||||
} else {
|
} else {
|
||||||
(false, self as $uty)
|
(false, self as $uty)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue