Fix clippy lints

This commit is contained in:
Amanieu d'Antras 2022-10-10 17:40:16 +01:00
parent 1bffeb803e
commit 2e0590c997
2 changed files with 6 additions and 6 deletions

View file

@ -13,7 +13,7 @@ mod int_to_float {
let a = (i << n) >> 8; // Significant bits, with bit 24 still in tact.
let b = (i << n) << 24; // Insignificant bits, only relevant for rounding.
let m = a + ((b - (b >> 31 & !a)) >> 31); // Add one when we need to round up. Break ties to even.
let e = 157 - n as u32; // Exponent plus 127, minus one.
let e = 157 - n; // Exponent plus 127, minus one.
(e << 23) + m // + not |, so the mantissa can overflow into the exponent.
}
@ -42,8 +42,8 @@ mod int_to_float {
return 0;
}
let n = i.leading_zeros();
let a = ((i << n) >> 11) as u64; // Significant bits, with bit 53 still in tact.
let b = ((i << n) << 53) as u64; // Insignificant bits, only relevant for rounding.
let a = (i << n) >> 11; // Significant bits, with bit 53 still in tact.
let b = (i << n) << 53; // Insignificant bits, only relevant for rounding.
let m = a + ((b - (b >> 63 & !a)) >> 63); // Add one when we need to round up. Break ties to even.
let e = 1085 - n as u64; // Exponent plus 1023, minus one.
(e << 52) + m // + not |, so the mantissa can overflow into the exponent.

View file

@ -135,11 +135,11 @@ where
let mut correction: u32 =
negate_u32(((reciprocal as u64).wrapping_mul(q31b as u64) >> 32) as u32);
reciprocal = ((reciprocal as u64).wrapping_mul(correction as u64) as u64 >> 31) as u32;
reciprocal = ((reciprocal as u64).wrapping_mul(correction as u64) >> 31) as u32;
correction = negate_u32(((reciprocal as u64).wrapping_mul(q31b as u64) >> 32) as u32);
reciprocal = ((reciprocal as u64).wrapping_mul(correction as u64) as u64 >> 31) as u32;
reciprocal = ((reciprocal as u64).wrapping_mul(correction as u64) >> 31) as u32;
correction = negate_u32(((reciprocal as u64).wrapping_mul(q31b as u64) >> 32) as u32);
reciprocal = ((reciprocal as u64).wrapping_mul(correction as u64) as u64 >> 31) as u32;
reciprocal = ((reciprocal as u64).wrapping_mul(correction as u64) >> 31) as u32;
// Exhaustive testing shows that the error in reciprocal after three steps
// is in the interval [-0x1.f58108p-31, 0x1.d0e48cp-29], in line with our