master
1const std = @import("std");
2const expect = std.testing.expect;
3
4const BitField = packed struct {
5 a: u3,
6 b: u3,
7 c: u2,
8};
9
10var bit_field = BitField{
11 .a = 1,
12 .b = 2,
13 .c = 3,
14};
15
16test "pointers of sub-byte-aligned fields share addresses" {
17 try expect(@intFromPtr(&bit_field.a) == @intFromPtr(&bit_field.b));
18 try expect(@intFromPtr(&bit_field.a) == @intFromPtr(&bit_field.c));
19}
20
21// test