From 673a6f9948a0076a3def3d23d2cb56ed501e233c Mon Sep 17 00:00:00 2001 From: est31 Date: Mon, 8 May 2017 04:03:16 +0200 Subject: [PATCH] Fix overflow bug when creating the absolute value Previously, the tests failed on some platforms due to it. --- src/int/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/int/mod.rs b/src/int/mod.rs index a94a070..768b6b4 100755 --- a/src/int/mod.rs +++ b/src/int/mod.rs @@ -63,7 +63,7 @@ macro_rules! int_impl { fn extract_sign(self) -> (bool, $uty) { if self < 0 { - (true, !(self as $uty) + 1) + (true, (!(self as $uty)).wrapping_add(1)) } else { (false, self as $uty) }