diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2023-06-24 16:58:19 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-06-24 16:58:19 -0700 |
| commit | 146b79af153bbd5dafda0ba12a040385c7fc58f8 (patch) | |
| tree | 67e3db8b444d65c667e314770fc983a7fc8ba293 /lib/std/fmt/parse_float/convert_slow.zig | |
| parent | 13853bef0df3c90633021850cc6d6abaeea03282 (diff) | |
| parent | 21ac0beb436f49fe49c6982a872f2dc48e4bea5e (diff) | |
| download | zig-146b79af153bbd5dafda0ba12a040385c7fc58f8.tar.gz zig-146b79af153bbd5dafda0ba12a040385c7fc58f8.zip | |
Merge pull request #16163 from mlugg/feat/builtins-infer-dest-ty
Infer destination type of cast builtins using result type
Diffstat (limited to 'lib/std/fmt/parse_float/convert_slow.zig')
| -rw-r--r-- | lib/std/fmt/parse_float/convert_slow.zig | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/std/fmt/parse_float/convert_slow.zig b/lib/std/fmt/parse_float/convert_slow.zig index 225a1e208c..53cb12ef13 100644 --- a/lib/std/fmt/parse_float/convert_slow.zig +++ b/lib/std/fmt/parse_float/convert_slow.zig @@ -48,13 +48,13 @@ pub fn convertSlow(comptime T: type, s: []const u8) BiasedFp(T) { var exp2: i32 = 0; // Shift right toward (1/2 .. 1] while (d.decimal_point > 0) { - const n = @intCast(usize, d.decimal_point); + const n = @as(usize, @intCast(d.decimal_point)); const shift = getShift(n); d.rightShift(shift); if (d.decimal_point < -Decimal(T).decimal_point_range) { return BiasedFp(T).zero(); } - exp2 += @intCast(i32, shift); + exp2 += @as(i32, @intCast(shift)); } // Shift left toward (1/2 .. 1] while (d.decimal_point <= 0) { @@ -66,7 +66,7 @@ pub fn convertSlow(comptime T: type, s: []const u8) BiasedFp(T) { else => 1, }; } else { - const n = @intCast(usize, -d.decimal_point); + const n = @as(usize, @intCast(-d.decimal_point)); break :blk getShift(n); } }; @@ -74,17 +74,17 @@ pub fn convertSlow(comptime T: type, s: []const u8) BiasedFp(T) { if (d.decimal_point > Decimal(T).decimal_point_range) { return BiasedFp(T).inf(T); } - exp2 -= @intCast(i32, shift); + exp2 -= @as(i32, @intCast(shift)); } // We are now in the range [1/2 .. 1] but the binary format uses [1 .. 2] exp2 -= 1; while (min_exponent + 1 > exp2) { - var n = @intCast(usize, (min_exponent + 1) - exp2); + var n = @as(usize, @intCast((min_exponent + 1) - exp2)); if (n > max_shift) { n = max_shift; } d.rightShift(n); - exp2 += @intCast(i32, n); + exp2 += @as(i32, @intCast(n)); } if (exp2 - min_exponent >= infinite_power) { return BiasedFp(T).inf(T); |
