Skip to content
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

[NFS_Reloaded] Use bitflags #8

Closed
Nielsbishere opened this issue Feb 19, 2019 · 1 comment
Closed

[NFS_Reloaded] Use bitflags #8

Nielsbishere opened this issue Feb 19, 2019 · 1 comment

Comments

@Nielsbishere
Copy link
Collaborator

Apparently bitflags are a thing in C; which also work in C++17. This means that instead of doing template magic, the compiler can handle it for us. The ux and u1 types can be removed.

u32 bits2 : 2;
u32 bits1 : 1;
u32 bits3 : 3;
u32 bits : 26;

This means the problem with structs that have different sizes can easily be fixed. It also means that the CPSR for ARM emulation could be perfectly emulated without a hassle:

u32 negative : 1;
u32 zero : 1;
u32 carry : 1;
u32 overflow : 1;
u32 saturation : 1;
u32 thumbIT0 : 2;
u32 jazelle : 1;
u32 pad0 : 4;
u32 condition: 4;
u32 thumbIT1 : 6;
u32 useBigEndian : 1;
u32 asyncAbort : 1;
u32 disableIRQ : 1;
u32 disableFIRQ : 1;
u32 thumbMode : 1;
u32 one : 1;
u32 systemMode : 4; //USR, FIQ, IRQ, SVC, MON, ABT, HYP, UND, SYS
@Nielsbishere
Copy link
Collaborator Author

Compiler dependent.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant