zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit 7babff0bc64fd91e6871e4facce5914b77e4827b (tree)
parent ddf9c40bc19761cd50c49d41d9501d3524a73561
Author: LemonBoy <thatlemon@gmail.com>
Date:   Sat,  5 Jun 2021 09:30:43 +0200

compiler-rt: Fix __floatunsitf signature

The function transforms an unsigned integer into a f128.

Closes #8996

Diffstat:
Mlib/std/special/compiler_rt/floatunsitf.zig | 4++--
Mlib/std/special/compiler_rt/floatunsitf_test.zig | 2+-
2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/std/special/compiler_rt/floatunsitf.zig b/lib/std/special/compiler_rt/floatunsitf.zig @@ -7,7 +7,7 @@ const builtin = @import("builtin"); const is_test = builtin.is_test; const std = @import("std"); -pub fn __floatunsitf(a: u64) callconv(.C) f128 { +pub fn __floatunsitf(a: u32) callconv(.C) f128 { @setRuntimeSafety(is_test); if (a == 0) { @@ -19,7 +19,7 @@ pub fn __floatunsitf(a: u64) callconv(.C) f128 { const exponent_bias = (1 << (exponent_bits - 1)) - 1; const implicit_bit = 1 << mantissa_bits; - const exp = (64 - 1) - @clz(u64, a); + const exp = (32 - 1) - @clz(u32, a); const shift = mantissa_bits - @intCast(u7, exp); // TODO(#1148): @bitCast alignment error diff --git a/lib/std/special/compiler_rt/floatunsitf_test.zig b/lib/std/special/compiler_rt/floatunsitf_test.zig @@ -5,7 +5,7 @@ // and substantial portions of the software. const __floatunsitf = @import("floatunsitf.zig").__floatunsitf; -fn test__floatunsitf(a: u64, expected_hi: u64, expected_lo: u64) !void { +fn test__floatunsitf(a: u32, expected_hi: u64, expected_lo: u64) !void { const x = __floatunsitf(a); const x_repr = @bitCast(u128, x);