extern defines the memory layout according to the C ABI: Documentation - The Zig Programming Language. The C implementation may introduce padding after/between fields for alignment reasons.
If you use packed struct, you’ll get 0 padding between fields, but that doesn’t mean an exact sizeOf: Inconsistent sizeOf vs bitSizeOf
Yes it is the padding!
But the layout of the struct is not garantueed to be in declaration order.
That is why I used extern.
After adding align(1) to the fields it was correct.
Packed struct is likely incorrect for this use case since you don’t want the backing integer to be a u448. extern struct with overridden alignment on a per-field basis is the right approach here.