mirror of
https://github.com/ziglang/zig.git
synced 2026-01-21 06:45:24 +00:00
Merge pull request #4832 from LemonBoy/watwatwat
Fix the weird-ass crash on AArch64
This commit is contained in:
commit
0d7bd9f3ce
@ -15,21 +15,6 @@ pip3 install s3cmd
|
||||
# This will affect the cmake command below.
|
||||
git config core.abbrev 9
|
||||
|
||||
# This patch is a workaround for
|
||||
# https://github.com/ziglang/zig/issues/4822
|
||||
patch <<'END_PATCH'
|
||||
--- CMakeLists.txt
|
||||
+++ CMakeLists.txt
|
||||
@@ -430,7 +430,6 @@ set(BUILD_LIBSTAGE2_ARGS "build-lib"
|
||||
--cache on
|
||||
--output-dir "${CMAKE_BINARY_DIR}"
|
||||
${LIBSTAGE2_RELEASE_ARG}
|
||||
- --bundle-compiler-rt
|
||||
-fPIC
|
||||
-lc
|
||||
${LIBSTAGE2_WINDOWS_ARGS}
|
||||
END_PATCH
|
||||
|
||||
mkdir build
|
||||
cd build
|
||||
cmake .. -DCMAKE_BUILD_TYPE=Release "-DCMAKE_INSTALL_PREFIX=$DISTDIR" -DZIG_STATIC=ON -DCMAKE_PREFIX_PATH=/deps/local
|
||||
|
||||
@ -2,7 +2,7 @@ const builtin = @import("builtin");
|
||||
const is_test = builtin.is_test;
|
||||
const std = @import("std");
|
||||
|
||||
pub fn __floatunditf(a: u128) callconv(.C) f128 {
|
||||
pub fn __floatunditf(a: u64) callconv(.C) f128 {
|
||||
@setRuntimeSafety(is_test);
|
||||
|
||||
if (a == 0) {
|
||||
@ -14,11 +14,11 @@ pub fn __floatunditf(a: u128) callconv(.C) f128 {
|
||||
const exponent_bias = (1 << (exponent_bits - 1)) - 1;
|
||||
const implicit_bit = 1 << mantissa_bits;
|
||||
|
||||
const exp = (u128.bit_count - 1) - @clz(u128, a);
|
||||
const shift = mantissa_bits - @intCast(u7, exp);
|
||||
const exp: u128 = (u64.bit_count - 1) - @clz(u64, a);
|
||||
const shift: u7 = mantissa_bits - @intCast(u7, exp);
|
||||
|
||||
var result: u128 align(16) = (a << shift) ^ implicit_bit;
|
||||
result += (@intCast(u128, exp) + exponent_bias) << mantissa_bits;
|
||||
var result: u128 = (@intCast(u128, a) << shift) ^ implicit_bit;
|
||||
result += (exp + exponent_bias) << mantissa_bits;
|
||||
|
||||
return @bitCast(f128, result);
|
||||
}
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
const __floatunditf = @import("floatunditf.zig").__floatunditf;
|
||||
|
||||
fn test__floatunditf(a: u128, expected_hi: u64, expected_lo: u64) void {
|
||||
fn test__floatunditf(a: u64, expected_hi: u64, expected_lo: u64) void {
|
||||
const x = __floatunditf(a);
|
||||
|
||||
const x_repr = @bitCast(u128, x);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user