| ... | ... | @@ -98,8 +98,8 @@ fn mulXf3(comptime T: type, a: T, b: T) T { |
| 98 | 98 | // one or both of a or b is denormal, the other (if applicable) is a |
| 99 | 99 | // normal number. Renormalize one or both of a and b, and set scale to |
| 100 | 100 | // include the necessary exponent adjustment. |
| 101 | | if (aAbs < implicitBit) scale +%= normalize(T, &aSignificand); |
| 102 | | if (bAbs < implicitBit) scale +%= normalize(T, &bSignificand); |
| 101 | if (aAbs < implicitBit) scale += normalize(T, &aSignificand); |
| 102 | if (bAbs < implicitBit) scale += normalize(T, &bSignificand); |
| 103 | 103 | } |
| 104 | 104 | |
| 105 | 105 | // Or in the implicit significand bit. (If we fell through from the |
| ... | ... | @@ -277,7 +277,7 @@ fn normalize(comptime T: type, significand: *std.meta.Int(.unsigned, @typeInfo(T |
| 277 | 277 | |
| 278 | 278 | const shift = @clz(Z, significand.*) - @clz(Z, implicitBit); |
| 279 | 279 | significand.* <<= @intCast(std.math.Log2Int(Z), shift); |
| 280 | | return 1 - shift; |
| 280 | return @as(i32, 1) - shift; |
| 281 | 281 | } |
| 282 | 282 | |
| 283 | 283 | fn wideRightShiftWithSticky(comptime Z: type, hi: *Z, lo: *Z, count: u32) void { |
| ... | ... | @@ -285,15 +285,15 @@ fn wideRightShiftWithSticky(comptime Z: type, hi: *Z, lo: *Z, count: u32) void { |
| 285 | 285 | const typeWidth = @typeInfo(Z).Int.bits; |
| 286 | 286 | const S = std.math.Log2Int(Z); |
| 287 | 287 | if (count < typeWidth) { |
| 288 | | const sticky = @truncate(u8, lo.* << @intCast(S, typeWidth -% count)); |
| 288 | const sticky = @boolToInt((lo.* << @intCast(S, typeWidth -% count)) != 0); |
| 289 | 289 | lo.* = (hi.* << @intCast(S, typeWidth -% count)) | (lo.* >> @intCast(S, count)) | sticky; |
| 290 | 290 | hi.* = hi.* >> @intCast(S, count); |
| 291 | 291 | } else if (count < 2 * typeWidth) { |
| 292 | | const sticky = @truncate(u8, hi.* << @intCast(S, 2 * typeWidth -% count) | lo.*); |
| 292 | const sticky = @boolToInt((hi.* << @intCast(S, 2 * typeWidth -% count) | lo.*) != 0); |
| 293 | 293 | lo.* = hi.* >> @intCast(S, count -% typeWidth) | sticky; |
| 294 | 294 | hi.* = 0; |
| 295 | 295 | } else { |
| 296 | | const sticky = @truncate(u8, hi.* | lo.*); |
| 296 | const sticky = @boolToInt((hi.* | lo.*) != 0); |
| 297 | 297 | lo.* = sticky; |
| 298 | 298 | hi.* = 0; |
| 299 | 299 | } |