diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2022-02-10 17:36:31 -0700 |
|---|---|---|
| committer | Jakub Konka <kubkon@jakubkonka.com> | 2022-02-12 11:18:23 +0100 |
| commit | 166db1a3ed7eca9b04b0626eaea8de0634ab9667 (patch) | |
| tree | 958a97baa486eda299dc268a83f3e89fd9a81f63 /lib | |
| parent | f293fbbeaf6c48e6ce1410743181f89f359eb697 (diff) | |
| download | zig-166db1a3ed7eca9b04b0626eaea8de0634ab9667.tar.gz zig-166db1a3ed7eca9b04b0626eaea8de0634ab9667.zip | |
stage1: fix f80 size and alignment on x86 and arm
* F80Repr extern struct needs no explicit padding; let's match the
target padding.
* stage2: fix lowering of f80 constants.
* stage1: decide ABI size and alignment of f80 based on alignment of
u64. x86 has alignof u64 equal to 4 but arm has it as 8.
* stage2: fix Value.floatReadFromMemory to use F80Repr
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/std/math.zig | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/lib/std/math.zig b/lib/std/math.zig index 6802d420fd..8398842e28 100644 --- a/lib/std/math.zig +++ b/lib/std/math.zig @@ -36,7 +36,6 @@ pub const sqrt2 = 1.414213562373095048801688724209698079; /// 1/sqrt(2) pub const sqrt1_2 = 0.707106781186547524400844362104849039; -// From a small c++ [program using boost float128](https://github.com/winksaville/cpp_boost_float128) pub const f128_true_min = @bitCast(f128, @as(u128, 0x00000000000000000000000000000001)); pub const f128_min = @bitCast(f128, @as(u128, 0x00010000000000000000000000000000)); pub const f128_max = @bitCast(f128, @as(u128, 0x7FFEFFFFFFFFFFFFFFFFFFFFFFFFFFFF)); @@ -44,12 +43,10 @@ pub const f128_epsilon = @bitCast(f128, @as(u128, 0x3F8F000000000000000000000000 pub const f128_toint = 1.0 / f128_epsilon; pub const F80Repr = if (@import("builtin").cpu.arch.endian() == .Little) extern struct { - fraction: u64, + fraction: u64 align(@alignOf(f80)), exp: u16, - _pad: u32 = undefined, } else extern struct { - exp: u16, - _pad: u32 = undefined, // TODO verify compatibility with hardware + exp: u16 align(@alignOf(f80)), fraction: u64, }; |
