diff options
| author | Andrew Kelley <superjoe30@gmail.com> | 2018-07-04 20:43:49 -0400 |
|---|---|---|
| committer | Andrew Kelley <superjoe30@gmail.com> | 2018-07-04 20:43:49 -0400 |
| commit | b5d07297dec61a3993dfe91ceee2c87672db1e8e (patch) | |
| tree | 519d097fcdfe121e38814a080868a85f5b1f9e64 /std | |
| parent | 9665cfe027c70a84cb6351ea6ecb833a728736aa (diff) | |
| parent | 8c39cdc89f2ae7fc25c3856e7c4c6b4662ac8a80 (diff) | |
| download | zig-b5d07297dec61a3993dfe91ceee2c87672db1e8e.tar.gz zig-b5d07297dec61a3993dfe91ceee2c87672db1e8e.zip | |
Merge remote-tracking branch 'origin/master' into llvm7
Diffstat (limited to 'std')
| -rw-r--r-- | std/mem.zig | 2 | ||||
| -rw-r--r-- | std/special/compiler_rt/comparetf2.zig | 4 | ||||
| -rw-r--r-- | std/special/compiler_rt/fixuint.zig | 6 | ||||
| -rw-r--r-- | std/special/compiler_rt/fixunstfdi_test.zig | 21 | ||||
| -rw-r--r-- | std/special/compiler_rt/fixunstfsi_test.zig | 4 | ||||
| -rw-r--r-- | std/special/compiler_rt/floatunsitf.zig | 2 |
6 files changed, 16 insertions, 23 deletions
diff --git a/std/mem.zig b/std/mem.zig index ba59faf711..b52d3e9f68 100644 --- a/std/mem.zig +++ b/std/mem.zig @@ -34,7 +34,7 @@ pub const Allocator = struct { /// Call `destroy` with the result pub fn create(self: *Allocator, init: var) Error!*@typeOf(init) { const T = @typeOf(init); - if (@sizeOf(T) == 0) return &{}; + if (@sizeOf(T) == 0) return &(T{}); const slice = try self.alloc(T, 1); const ptr = &slice[0]; ptr.* = init; diff --git a/std/special/compiler_rt/comparetf2.zig b/std/special/compiler_rt/comparetf2.zig index 479ba51962..0912b71bd5 100644 --- a/std/special/compiler_rt/comparetf2.zig +++ b/std/special/compiler_rt/comparetf2.zig @@ -1,4 +1,4 @@ -// TODO https://github.com/ziglang/zig/issues/305 +// TODO https://github.com/ziglang/zig/issues/641 // and then make the return types of some of these functions the enum instead of c_int const LE_LESS = c_int(-1); const LE_EQUAL = c_int(0); @@ -56,7 +56,7 @@ pub extern fn __letf2(a: f128, b: f128) c_int { LE_GREATER; } -// TODO https://github.com/ziglang/zig/issues/305 +// TODO https://github.com/ziglang/zig/issues/641 // and then make the return types of some of these functions the enum instead of c_int const GE_LESS = c_int(-1); const GE_EQUAL = c_int(0); diff --git a/std/special/compiler_rt/fixuint.zig b/std/special/compiler_rt/fixuint.zig index 48d63ed914..55a113b368 100644 --- a/std/special/compiler_rt/fixuint.zig +++ b/std/special/compiler_rt/fixuint.zig @@ -44,14 +44,8 @@ pub fn fixuint(comptime fp_t: type, comptime fixuint_t: type, a: fp_t) fixuint_t // If 0 <= exponent < significandBits, right shift to get the result. // Otherwise, shift left. if (exponent < significandBits) { - // TODO this is a workaround for the mysterious "integer cast truncated bits" - // happening on the next line - @setRuntimeSafety(false); return @intCast(fixuint_t, significand >> @intCast(Log2Int(rep_t), significandBits - exponent)); } else { - // TODO this is a workaround for the mysterious "integer cast truncated bits" - // happening on the next line - @setRuntimeSafety(false); return @intCast(fixuint_t, significand) << @intCast(Log2Int(fixuint_t), exponent - significandBits); } } diff --git a/std/special/compiler_rt/fixunstfdi_test.zig b/std/special/compiler_rt/fixunstfdi_test.zig index dd0869195a..6b1b9b7bd2 100644 --- a/std/special/compiler_rt/fixunstfdi_test.zig +++ b/std/special/compiler_rt/fixunstfdi_test.zig @@ -36,15 +36,14 @@ test "fixunstfdi" { test__fixunstfdi(-0x1.FFFFFFFFFFFFFp+62, 0); test__fixunstfdi(-0x1.FFFFFFFFFFFFEp+62, 0); - // TODO enable these tests when we can parse f128 float literals - //test__fixunstfdi(0x1.FFFFFFFFFFFFFFFEp+63, 0xFFFFFFFFFFFFFFFF); - //test__fixunstfdi(0x1.0000000000000002p+63, 0x8000000000000001); - //test__fixunstfdi(0x1.0000000000000000p+63, 0x8000000000000000); - //test__fixunstfdi(0x1.FFFFFFFFFFFFFFFCp+62, 0x7FFFFFFFFFFFFFFF); - //test__fixunstfdi(0x1.FFFFFFFFFFFFFFF8p+62, 0x7FFFFFFFFFFFFFFE); - //test__fixunstfdi(0x1.p+64, 0xFFFFFFFFFFFFFFFF); - - //test__fixunstfdi(-0x1.0000000000000000p+63, 0); - //test__fixunstfdi(-0x1.FFFFFFFFFFFFFFFCp+62, 0); - //test__fixunstfdi(-0x1.FFFFFFFFFFFFFFF8p+62, 0); + test__fixunstfdi(0x1.FFFFFFFFFFFFFFFEp+63, 0xFFFFFFFFFFFFFFFF); + test__fixunstfdi(0x1.0000000000000002p+63, 0x8000000000000001); + test__fixunstfdi(0x1.0000000000000000p+63, 0x8000000000000000); + test__fixunstfdi(0x1.FFFFFFFFFFFFFFFCp+62, 0x7FFFFFFFFFFFFFFF); + test__fixunstfdi(0x1.FFFFFFFFFFFFFFF8p+62, 0x7FFFFFFFFFFFFFFE); + test__fixunstfdi(0x1.p+64, 0xFFFFFFFFFFFFFFFF); + + test__fixunstfdi(-0x1.0000000000000000p+63, 0); + test__fixunstfdi(-0x1.FFFFFFFFFFFFFFFCp+62, 0); + test__fixunstfdi(-0x1.FFFFFFFFFFFFFFF8p+62, 0); } diff --git a/std/special/compiler_rt/fixunstfsi_test.zig b/std/special/compiler_rt/fixunstfsi_test.zig index f682191994..f47fcb3c86 100644 --- a/std/special/compiler_rt/fixunstfsi_test.zig +++ b/std/special/compiler_rt/fixunstfsi_test.zig @@ -11,9 +11,9 @@ const inf128 = @bitCast(f128, u128(0x7fff0000000000000000000000000000)); test "fixunstfsi" { test__fixunstfsi(inf128, 0xffffffff); test__fixunstfsi(0, 0x0); - //TODO test__fixunstfsi(0x1.23456789abcdefp+5, 0x24); + test__fixunstfsi(0x1.23456789abcdefp+5, 0x24); test__fixunstfsi(0x1.23456789abcdefp-3, 0x0); - //TODO test__fixunstfsi(0x1.23456789abcdefp+20, 0x123456); + test__fixunstfsi(0x1.23456789abcdefp+20, 0x123456); test__fixunstfsi(0x1.23456789abcdefp+40, 0xffffffff); test__fixunstfsi(0x1.23456789abcdefp+256, 0xffffffff); test__fixunstfsi(-0x1.23456789abcdefp+3, 0x0); diff --git a/std/special/compiler_rt/floatunsitf.zig b/std/special/compiler_rt/floatunsitf.zig index 625f90a3d0..19a5918bd0 100644 --- a/std/special/compiler_rt/floatunsitf.zig +++ b/std/special/compiler_rt/floatunsitf.zig @@ -17,7 +17,7 @@ pub extern fn __floatunsitf(a: u64) f128 { const exp = (u64.bit_count - 1) - @clz(a); const shift = mantissa_bits - @intCast(u7, exp); - // TODO: @bitCast alignment error + // TODO(#1148): @bitCast alignment error var result align(16) = (@intCast(u128, a) << shift) ^ implicit_bit; result += (@intCast(u128, exp) + exponent_bias) << mantissa_bits; |
