Skip to content

Instantly share code, notes, and snippets.

@yamafaktory
Created November 25, 2024 10:47
Show Gist options
  • Save yamafaktory/e1f8bb5b589f96319ec2b5d203680d54 to your computer and use it in GitHub Desktop.
Save yamafaktory/e1f8bb5b589f96319ec2b5d203680d54 to your computer and use it in GitHub Desktop.
Check if type T is a packed struct at comptime in Zig
// Check if type T is a packed struct at comptime.
comptime {
assert(@typeInfo(T) == .Struct);
assert(@typeInfo(T).Struct.backing_integer != null);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment