| ... | @@ -2,7 +2,7 @@ const std = @import("std"); | ... | @@ -2,7 +2,7 @@ const std = @import("std"); |
| 2 | const expect = std.testing.expect; | 2 | const expect = std.testing.expect; |
| 3 | const expectEqualSlices = std.testing.expectEqualSlices; | 3 | const expectEqualSlices = std.testing.expectEqualSlices; |
| 4 | const builtin = @import("builtin"); | 4 | const builtin = @import("builtin"); |
| 5 | const maxInt = std.math.maxInt; | 5 | const maxInt = std.math.maxInt; |
| 6 | const StructWithNoFields = struct { | 6 | const StructWithNoFields = struct { |
| 7 | fn add(a: i32, b: i32) i32 { | 7 | fn add(a: i32, b: i32) i32 { |
| 8 | return a + b; | 8 | return a + b; |
| ... | @@ -256,7 +256,11 @@ const Foo96Bits = packed struct { | ... | @@ -256,7 +256,11 @@ const Foo96Bits = packed struct { |
| 256 | test "packed struct 24bits" { | 256 | test "packed struct 24bits" { |
| 257 | comptime { | 257 | comptime { |
| 258 | expect(@sizeOf(Foo24Bits) == 4); | 258 | expect(@sizeOf(Foo24Bits) == 4); |
| 259 | expect(@sizeOf(Foo96Bits) == 16); | 259 | if (@sizeOf(usize) == 4) { |
| | 260 | expect(@sizeOf(Foo96Bits) == 12); |
| | 261 | } else { |
| | 262 | expect(@sizeOf(Foo96Bits) == 16); |
| | 263 | } |
| 260 | } | 264 | } |
| 261 | | 265 | |
| 262 | var value = Foo96Bits{ | 266 | var value = Foo96Bits{ |
| ... | @@ -505,10 +509,10 @@ test "packed struct with u0 field access" { | ... | @@ -505,10 +509,10 @@ test "packed struct with u0 field access" { |
| 505 | comptime expect(s.f0 == 0); | 509 | comptime expect(s.f0 == 0); |
| 506 | } | 510 | } |
| 507 | | 511 | |
| 508 | const S0 = struct{ | 512 | const S0 = struct { |
| 509 | bar: S1, | 513 | bar: S1, |
| 510 | | 514 | |
| 511 | pub const S1 = struct{ | 515 | pub const S1 = struct { |
| 512 | value: u8, | 516 | value: u8, |
| 513 | }; | 517 | }; |
| 514 | | 518 | |