]> git.lizzy.rs Git - rust.git/blobdiff - src/librustc_apfloat/lib.rs
Fix bug in rustc_apfloat
[rust.git] / src / librustc_apfloat / lib.rs
index 9e348f622232961aa01152112d6908fc17f6881f..2048127222bb73c50a423c8d79ba72407d0076fc 100644 (file)
@@ -378,7 +378,7 @@ fn copy_sign(self, rhs: Self) -> Self {
     fn from_bits(input: u128) -> Self;
     fn from_i128_r(input: i128, round: Round) -> StatusAnd<Self> {
         if input < 0 {
-            Self::from_u128_r(-input as u128, -round).map(|r| -r)
+            Self::from_u128_r(input.wrapping_neg() as u128, -round).map(|r| -r)
         } else {
             Self::from_u128_r(input as u128, round)
         }