Closed marler8997 closed 3 years ago
Nevermind, thanks to daurnimator, he pointed out zig already supports field alignment.
// emulate PackingSize of 2
const S = packed struct {
foo: T align(2),
bar: U align(2),
};
Fixed in https://github.com/marlersoft/zigwin32/commit/e6c6b6c5ad720bb08c92e01750fee4423419d7c5
A "PackingSize" of
0
is equivalent to anextern struct/union
in Zig, and a PackingSize of1
is equivalent to apacked struct/union
in Zig. However, Zig doesn't have a way to modify a struct to emulate packing sizes larger than 1.My current idea to support this, is when the packing size is greater than 1, I can use a
packed
struct, and then add padding between each field based on the size of the previous field, i.e.