@@ -43,7 +43,7 @@ macro_rules! add {
43
43
44
44
if a_abs == inf_rep {
45
45
// +/-infinity + -/+infinity = qNaN
46
- if a. repr( ) ^ b. repr( ) == sign_bit. 0 {
46
+ if ( a. repr( ) ^ b. repr( ) ) == sign_bit. 0 {
47
47
return ( <$ty as Float >:: from_repr( qnan_rep. 0 ) ) ;
48
48
} else {
49
49
// +/-infinity + anything remaining = +/- infinity
@@ -100,7 +100,7 @@ macro_rules! add {
100
100
// The sign of the result is the sign of the larger operand, a. If they
101
101
// have opposite signs, we are performing a subtraction; otherwise addition.
102
102
let result_sign = a_rep & sign_bit;
103
- let subtraction = ( a_rep ^ b_rep) & sign_bit != zero;
103
+ let subtraction = ( ( a_rep ^ b_rep) & sign_bit) != zero;
104
104
105
105
// Shift the significands to give us round, guard and sticky, and or in the
106
106
// implicit significand bit. (If we fell through from the denormal path it
@@ -115,7 +115,7 @@ macro_rules! add {
115
115
if align. 0 != 0 {
116
116
if align < bits {
117
117
let sticky = ( ( b_significand << ( bits - align) . 0 as usize ) . 0 != 0 ) as <$ty as Float >:: Int ;
118
- b_significand = b_significand >> ( align. 0 | sticky ) as usize ;
118
+ b_significand = ( b_significand >> align. 0 as usize ) | Wrapping ( sticky ) ;
119
119
} else {
120
120
b_significand = one; // sticky; b is known to be non-zero.
121
121
}
@@ -173,8 +173,8 @@ macro_rules! add {
173
173
174
174
// Final rounding. The result may overflow to infinity, but that is the
175
175
// correct result in that case.
176
- if round_guard_sticky > Wrapping ( 0x4 ) { result += one; }
177
- if round_guard_sticky == Wrapping ( 0x4 ) { result += result & one; }
176
+ if round_guard_sticky. 0 > 0x4 { result += one; }
177
+ if round_guard_sticky. 0 == 0x4 { result += result & one; }
178
178
return ( <$ty>:: from_repr( result. 0 ) ) ;
179
179
}
180
180
}
0 commit comments