@@ -42,7 +42,7 @@ mod int_to_float {
42
42
fn m_adj < F : Float > ( m_base : F :: Int , dropped_bits : F :: Int ) -> F :: Int {
43
43
// Branchlessly extract a `1` if rounding up should happen, 0 otherwise
44
44
// This accounts for rounding to even.
45
- let adj = ( dropped_bits - ( dropped_bits >> ( F :: BITS - 1 ) & !m_base) ) >> ( F :: BITS - 1 ) ;
45
+ let adj = ( dropped_bits - ( ( dropped_bits >> ( F :: BITS - 1 ) ) & !m_base) ) >> ( F :: BITS - 1 ) ;
46
46
47
47
// Add one when we need to round up. Break ties to even.
48
48
m_base + adj
@@ -129,7 +129,7 @@ mod int_to_float {
129
129
let m_base: u32 = ( i_m >> shift_f_lt_i :: < u64 , f32 > ( ) ) as u32 ;
130
130
// The entire lower half of `i` will be truncated (masked portion), plus the
131
131
// next `EXP_BITS` bits.
132
- let adj = ( i_m >> f32:: EXP_BITS | i_m & 0xFFFF ) as u32 ;
132
+ let adj = ( ( i_m >> f32:: EXP_BITS ) | i_m & 0xFFFF ) as u32 ;
133
133
let m = m_adj :: < f32 > ( m_base, adj) ;
134
134
let e = if i == 0 { 0 } else { exp :: < u64 , f32 > ( n) - 1 } ;
135
135
repr :: < f32 > ( e, m)
@@ -187,7 +187,7 @@ mod int_to_float {
187
187
let m_base: u64 = ( i_m >> shift_f_lt_i :: < u128 , f64 > ( ) ) as u64 ;
188
188
// The entire lower half of `i` will be truncated (masked portion), plus the
189
189
// next `EXP_BITS` bits.
190
- let adj = ( i_m >> f64:: EXP_BITS | i_m & 0xFFFF_FFFF ) as u64 ;
190
+ let adj = ( ( i_m >> f64:: EXP_BITS ) | i_m & 0xFFFF_FFFF ) as u64 ;
191
191
let m = m_adj :: < f64 > ( m_base, adj) ;
192
192
let e = if i == 0 { 0 } else { exp :: < u128 , f64 > ( n) - 1 } ;
193
193
repr :: < f64 > ( e, m)
@@ -377,7 +377,7 @@ where
377
377
} ;
378
378
379
379
// Set the implicit 1-bit.
380
- let m: I :: UnsignedInt = I :: UnsignedInt :: ONE << ( I :: BITS - 1 ) | m_base;
380
+ let m: I :: UnsignedInt = ( I :: UnsignedInt :: ONE << ( I :: BITS - 1 ) ) | m_base;
381
381
382
382
// Shift based on the exponent and bias.
383
383
let s: u32 = ( foobar) - u32:: cast_from ( fbits >> F :: SIG_BITS ) ;
0 commit comments