authorgravatar for thatlemon@gmail.comLemonBoy <thatlemon@gmail.com> 2021-06-05 09:30:43+02:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2021-06-05 13:32:41-04:00
log7babff0bc64fd91e6871e4facce5914b77e4827b
tree5d75764ac39936431e4d3d4a80173eb67338a74b
parentddf9c40bc19761cd50c49d41d9501d3524a73561

compiler-rt: Fix __floatunsitf signature

The function transforms an unsigned integer into a f128. Closes #8996

2 files changed, 3 insertions(+), 3 deletions(-)

lib/std/special/compiler_rt/floatunsitf.zig+2-2
...@@ -7,7 +7,7 @@ const builtin = @import("builtin");...@@ -7,7 +7,7 @@ const builtin = @import("builtin");
7const is_test = builtin.is_test;7const is_test = builtin.is_test;
8const std = @import("std");8const std = @import("std");
99
10pub fn __floatunsitf(a: u64) callconv(.C) f128 {10pub fn __floatunsitf(a: u32) callconv(.C) f128 {
11 @setRuntimeSafety(is_test);11 @setRuntimeSafety(is_test);
1212
13 if (a == 0) {13 if (a == 0) {
...@@ -19,7 +19,7 @@ pub fn __floatunsitf(a: u64) callconv(.C) f128 {...@@ -19,7 +19,7 @@ pub fn __floatunsitf(a: u64) callconv(.C) f128 {
19 const exponent_bias = (1 << (exponent_bits - 1)) - 1;19 const exponent_bias = (1 << (exponent_bits - 1)) - 1;
20 const implicit_bit = 1 << mantissa_bits;20 const implicit_bit = 1 << mantissa_bits;
2121
22 const exp = (64 - 1) - @clz(u64, a);22 const exp = (32 - 1) - @clz(u32, a);
23 const shift = mantissa_bits - @intCast(u7, exp);23 const shift = mantissa_bits - @intCast(u7, exp);
2424
25 // TODO(#1148): @bitCast alignment error25 // TODO(#1148): @bitCast alignment error
lib/std/special/compiler_rt/floatunsitf_test.zig+1-1
...@@ -5,7 +5,7 @@...@@ -5,7 +5,7 @@
5// and substantial portions of the software.5// and substantial portions of the software.
6const __floatunsitf = @import("floatunsitf.zig").__floatunsitf;6const __floatunsitf = @import("floatunsitf.zig").__floatunsitf;
77
8fn test__floatunsitf(a: u64, expected_hi: u64, expected_lo: u64) !void {8fn test__floatunsitf(a: u32, expected_hi: u64, expected_lo: u64) !void {
9 const x = __floatunsitf(a);9 const x = __floatunsitf(a);
1010
11 const x_repr = @bitCast(u128, x);11 const x_repr = @bitCast(u128, x);