renderer/opengl: comptime assertion to verify

This commit is contained in:
Mitchell Hashimoto
2024-08-06 10:07:08 -07:00
parent 5be3098963
commit 247d5e4411

View File

@ -64,6 +64,13 @@ pub const CellMode = enum(u8) {
}
pub fn isFg(self: CellMode) bool {
// Since we use bit tricks below, we want to ensure the enum
// doesn't change without us looking at this logic again.
comptime {
const info = @typeInfo(CellMode).Enum;
std.debug.assert(info.fields.len == 5);
}
return @intFromEnum(self) & @intFromEnum(@as(CellMode, .fg)) != 0;
}
};