| ... | ... | @@ -17,14 +17,15 @@ test "integer literal to pointer cast" { |
| 17 | 17 | } |
| 18 | 18 | |
| 19 | 19 | test "pointer reinterpret const float to int" { |
| 20 | | // https://github.com/ziglang/zig/issues/3345 |
| 21 | | if (std.Target.current.cpu.arch == .mips) return error.SkipZigTest; |
| 22 | | |
| 20 | // The hex representation is 0x3fe3333333333303. |
| 23 | 21 | const float: f64 = 5.99999999999994648725e-01; |
| 24 | 22 | const float_ptr = &float; |
| 25 | 23 | const int_ptr = @ptrCast(*const i32, float_ptr); |
| 26 | 24 | const int_val = int_ptr.*; |
| 27 | | expect(int_val == 858993411); |
| 25 | if (std.builtin.endian == .Little) |
| 26 | expect(int_val == 0x33333303) |
| 27 | else |
| 28 | expect(int_val == 0x3fe33333); |
| 28 | 29 | } |
| 29 | 30 | |
| 30 | 31 | test "implicitly cast indirect pointer to maybe-indirect pointer" { |