Hellope!
I am currently making bindings from a C library for Odin. I am having issues with converting the following packed C struct to Odin:
struct TopLevelInstance {
uint32_t shaderBindingTableRecordOffset : 24;
TopLevelInstanceBits flags : 8;
};
The C version packs the two values into a single 32 bit value (24 + 8 = 32) so the Odin version of the struct should logically be a 32 bit bit_field:
TopLevelInstance :: struct {
shader: bit_field u32 {
shaderBindingTableRecordOffset: u32 | 24,
flags: TopLevelInstanceBits | 8,
},
}
The issue is that TopLevelInstanceBits is a bit_set in Odin but bit_set is not allowed as a type in bit_field.
I could define the field as a u8 but that would make the bidings harder to use since the user would have to transmute the TopLevelInstanceBits to u8.
Does anyone here know why bit_set is not allowed in bit_field or know of a workaround?
