Packed structs in Zig make bit/flag sets trivial
Packed structs in Zig make bit/flag sets trivial
devlog.hexops.com Packed structs in Zig make bit/flag sets trivial
As we've been building Mach engine, we've been using a neat little pattern in Zig that enables writing flag sets more nicely in Zig than in other languages. Here's a brief explainer.
![Packed structs in Zig make bit/flag sets trivial](https://lemmy.ml/pictrs/image/76b3a39c-b7f9-46bc-99e7-f974df68b664.png?format=webp&thumbnail=256)
Bumped into this article about bit-sized booleans in Zig packed structs, thought it might be interesting to others.
0
comments