소스 검색

Fix overflow bug when creating the absolute value

Previously, the tests failed on some platforms due to it.
est31 8 년 전
부모
커밋
673a6f9948
1개의 변경된 파일1개의 추가작업 그리고 1개의 파일을 삭제
  1. 1 1
      src/int/mod.rs

+ 1 - 1
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)
                 }