odin-lang / Odin

Odin Programming Language
https://odin-lang.org
BSD 3-Clause "New" or "Revised" License
6.12k stars 550 forks source link

corrected the wrong value of CREATE_FACTORY_FLAG.DEBUG #3752

Closed chromedays closed 3 weeks ago

chromedays commented 3 weeks ago

CREATE_FACTORY_FLAG.DEBUG should be 1 as noted in the original docs: https://learn.microsoft.com/en-us/windows/win32/api/dxgi1_3/nf-dxgi1_3-createdxgifactory2

Valid values include the DXGI_CREATE_FACTORY_DEBUG (0x01) flag, and zero.

I also removed the integer constant that is redundant and incompatible to the CREATE_FACTORY bitset

laytan commented 3 weeks ago

An enum used by a bit set will not have the same values as they would be in C. In Odin each enum value is basically the bit index of the flags, aka the log2 of the value in C. So in this case log2(0x01) = 0 meaning the current value of 0 should be correct.

Foo :: enum { Bar = 0 }
Foos :: bit_set[Foo; u32]
assert(transmute(u32)Foos{.Bar} == 0x1)
chromedays commented 3 weeks ago

Ohh... didn't notice that. Thank you for clarifying.