-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use bool for bitfield values #103
Conversation
Which compilers require |
Norcroft produces errors if Regarding the total size of the bit fields, I did some investigation and it seems that if you use bitfield and non-bitfield values in the same structure, GCC at least will limit the size of the bitfields appropriately. As such, I think the |
It seems that only the It seems that using So the single bit bitfields should be changed to |
It does, but it always pads the bitfield to 32 bits. This might cause a problem with using |
The |
I didn't consider the 16-bit |
0e4d172
to
7998636
Compare
I've pushed an update that reverts the changes to |
I think that the changes to the joypad struct should also be isolated in its own pull request. In addition, the removal of the bitfields for the joypad would break the API compatibility, so it could only really be made a in a major version bump. Is there a benefit to changing I'll have to give more thought the to use of the joypad bitfields. |
It's now in PR #106, which now deprecates the bitfield instead of removing it.
Mostly just correctness, however the changes to the SDL2 example are needed to fix a warning. |
Thanks! |
The
joypad_bits
bitfield has been removed since it relied on specific positions, however the layout is not standardised and may differ between compilers: https://stackoverflow.com/questions/19376426/order-of-fields-when-using-a-bit-field-in-cThe rest of the bitfield have been changed to use
unsigned int
instead ofuint8_t
for compatibility with more compilers.