reduce convertions in signum
authoralfadur
Thu, 04 Jul 2019 21:40:50 +0300
changeset 15218 517f3a1dd5c2
parent 15217 293250953317
child 15219 58a0f2a6527b
reduce convertions in signum
rust/fpnum/src/lib.rs
--- a/rust/fpnum/src/lib.rs	Thu Jul 04 19:21:56 2019 +0300
+++ b/rust/fpnum/src/lib.rs	Thu Jul 04 21:40:50 2019 +0300
@@ -26,7 +26,7 @@
 
     #[inline]
     pub fn signum(&self) -> i8 {
-        (1u8 ^ self.sign_mask as u8).wrapping_sub(self.sign_mask as u8) as i8
+        (1u64 ^ self.sign_mask).wrapping_sub(self.sign_mask) as i8
     }
 
     #[inline]