| ... | ... | @@ -18,6 +18,8 @@ const A = struct { |
| 18 | 18 | e: u5, |
| 19 | 19 | f: u16, |
| 20 | 20 | g: u16, |
| 21 | h: u9, |
| 22 | i: u7, |
| 21 | 23 | }; |
| 22 | 24 | |
| 23 | 25 | const P = packed struct { |
| ... | ... | @@ -53,6 +55,8 @@ test "@byteOffsetOf" { |
| 53 | 55 | expect(@ptrToInt(&a.e) - @ptrToInt(&a) == @byteOffsetOf(A, "e")); |
| 54 | 56 | expect(@ptrToInt(&a.f) - @ptrToInt(&a) == @byteOffsetOf(A, "f")); |
| 55 | 57 | expect(@ptrToInt(&a.g) - @ptrToInt(&a) == @byteOffsetOf(A, "g")); |
| 58 | expect(@ptrToInt(&a.h) - @ptrToInt(&a) == @byteOffsetOf(A, "h")); |
| 59 | expect(@ptrToInt(&a.i) - @ptrToInt(&a) == @byteOffsetOf(A, "i")); |
| 56 | 60 | } |
| 57 | 61 | |
| 58 | 62 | test "@byteOffsetOf packed struct, array length not power of 2 or multiple of native pointer width in bytes" { |