compiler-rt: Fix __floatunsitf signature

The function transforms an unsigned integer into a f128.

Closes #8996
This commit is contained in:
LemonBoy
2021-06-05 09:30:43 +02:00
committed by Andrew Kelley
parent ddf9c40bc1
commit 7babff0bc6
2 changed files with 3 additions and 3 deletions

View File

@@ -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

View File

@@ -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);