@@ -10,8 +10,8 @@ mod int_to_float {
1010 return 0 ;
1111 }
1212 let n = i. leading_zeros ( ) ;
13- let a = i << n >> 8 ; // Significant bits, with bit 24 still in tact.
14- let b = i << n << 24 ; // Insignificant bits, only relevant for rounding.
13+ let a = ( i << n) >> 8 ; // Significant bits, with bit 24 still in tact.
14+ let b = ( i << n) << 24 ; // Insignificant bits, only relevant for rounding.
1515 let m = a + ( ( b - ( b >> 31 & !a) ) >> 31 ) ; // Add one when we need to round up. Break ties to even.
1616 let e = 157 - n as u32 ; // Exponent plus 127, minus one.
1717 ( e << 23 ) + m // + not |, so the mantissa can overflow into the exponent.
@@ -42,8 +42,8 @@ mod int_to_float {
4242 return 0 ;
4343 }
4444 let n = i. leading_zeros ( ) ;
45- let a = ( i << n >> 11 ) as u64 ; // Significant bits, with bit 53 still in tact.
46- let b = ( i << n << 53 ) as u64 ; // Insignificant bits, only relevant for rounding.
45+ let a = ( ( i << n) >> 11 ) as u64 ; // Significant bits, with bit 53 still in tact.
46+ let b = ( ( i << n) << 53 ) as u64 ; // Insignificant bits, only relevant for rounding.
4747 let m = a + ( ( b - ( b >> 63 & !a) ) >> 63 ) ; // Add one when we need to round up. Break ties to even.
4848 let e = 1085 - n as u64 ; // Exponent plus 1023, minus one.
4949 ( e << 52 ) + m // + not |, so the mantissa can overflow into the exponent.
@@ -53,7 +53,7 @@ mod int_to_float {
5353 let n = i. leading_zeros ( ) ;
5454 let y = i. wrapping_shl ( n) ;
5555 let a = ( y >> 104 ) as u32 ; // Significant bits, with bit 24 still in tact.
56- let b = ( y >> 72 ) as u32 | ( y << 32 >> 32 != 0 ) as u32 ; // Insignificant bits, only relevant for rounding.
56+ let b = ( y >> 72 ) as u32 | ( ( y << 32 ) >> 32 != 0 ) as u32 ; // Insignificant bits, only relevant for rounding.
5757 let m = a + ( ( b - ( b >> 31 & !a) ) >> 31 ) ; // Add one when we need to round up. Break ties to even.
5858 let e = if i == 0 { 0 } else { 253 - n } ; // Exponent plus 127, minus one, except for zero.
5959 ( e << 23 ) + m // + not |, so the mantissa can overflow into the exponent.
0 commit comments