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_fast.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_fast.zig')
| -rw-r--r-- | lib/std/fmt/parse_float/convert_fast.zig | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/std/fmt/parse_float/convert_fast.zig b/lib/std/fmt/parse_float/convert_fast.zig index 2124e436ab..a148d3946f 100644 --- a/lib/std/fmt/parse_float/convert_fast.zig +++ b/lib/std/fmt/parse_float/convert_fast.zig @@ -108,19 +108,19 @@ pub fn convertFast(comptime T: type, n: Number(T)) ?T { var value: T = 0; if (n.exponent <= info.max_exponent_fast_path) { // normal fast path - value = @floatFromInt(T, n.mantissa); + value = @as(T, @floatFromInt(n.mantissa)); value = if (n.exponent < 0) - value / fastPow10(T, @intCast(usize, -n.exponent)) + value / fastPow10(T, @as(usize, @intCast(-n.exponent))) else - value * fastPow10(T, @intCast(usize, n.exponent)); + value * fastPow10(T, @as(usize, @intCast(n.exponent))); } else { // disguised fast path const shift = n.exponent - info.max_exponent_fast_path; - const mantissa = math.mul(MantissaT, n.mantissa, fastIntPow10(MantissaT, @intCast(usize, shift))) catch return null; + const mantissa = math.mul(MantissaT, n.mantissa, fastIntPow10(MantissaT, @as(usize, @intCast(shift)))) catch return null; if (mantissa > info.max_mantissa_fast_path) { return null; } - value = @floatFromInt(T, mantissa) * fastPow10(T, info.max_exponent_fast_path); + value = @as(T, @floatFromInt(mantissa)) * fastPow10(T, info.max_exponent_fast_path); } if (n.negative) { |
