| author | |
| committer | |
| log | 939ec878a00803502f2e07347c09fa6736c5f44a |
| tree | 18d664bc352ee3ae609a64cef291b0151819e468 |
| parent | 60242e96dfd509eeb7a5746128410f471eb06dac |
The operands may be zero, use the wrapping operators and avoid a
spurious integer-overflow error.1 files changed, 2 insertions(+), 2 deletions(-)
std/special/compiler_rt/addXf3.zig+2-2| ... | ... | @@ -78,8 +78,8 @@ fn addXf3(comptime T: type, a: T, b: T) T { |
| 78 | 78 | const infRep = @bitCast(Z, std.math.inf(T)); |
| 79 | 79 | |
| 80 | 80 | // Detect if a or b is zero, infinity, or NaN. |
| 81 | if (aAbs - Z(1) >= infRep - Z(1) or | |
| 82 | bAbs - Z(1) >= infRep - Z(1)) | |
| 81 | if (aAbs -% Z(1) >= infRep - Z(1) or | |
| 82 | bAbs -% Z(1) >= infRep - Z(1)) | |
| 83 | 83 | { |
| 84 | 84 | // NaN + anything = qNaN |
| 85 | 85 | if (aAbs > infRep) return @bitCast(T, @bitCast(Z, a) | quietBit); |