Thanks for an answer.
Yes, I've noted it, just didn't want to comment on it.
/* Also, I personally would use e.g
#define FLAG_1 0x01
instead of
#define FLAG_1 (1 << 0) */
You know when you have a list of them, it becomes more clear my way (IMHO)
especially with the PowerPC and IBM's damn backwards bits. E.g. if you
want to create masks for an IBM PowerPC register using IBM's bit notation
from the data book without translating in your brain you just do this:
/* flag reg. IBM datasheet
** width size bit position
** - 1
** | | |
** v v v */
#define CPC0_CR0_TRE (1 << 31 - 4)
#define CPC0_CR0_G10E (1 << 31 - 5)
#define CPC0_CR0_G11E (1 << 31 - 6)
#define CPC0_CR0_G12E (1 << 31 - 7)
#define CPC0_CR0_G13E (1 << 31 - 8)
#define CPC0_CR0_G14E (1 << 31 - 9)
#define CPC0_CR0_G15E (1 << 31 - 10)
#define CPC0_CR0_G16E (1 << 31 - 11)
#define CPC0_CR0_G17E (1 << 31 - 12)
#define CPC0_CR0_G18E (1 << 31 - 13)
#define CPC0_CR0_G19E (1 << 31 - 14)
#define CPC0_CR0_G20E (1 << 31 - 15)
#define CPC0_CR0_G21E (1 << 31 - 16)
#define CPC0_CR0_G22E (1 << 31 - 17)
#define CPC0_CR0_G23E (1 << 31 - 18)
#define CPC0_CR0_DCS (1 << 31 - 19)
#define CPC0_CR0_RDS (1 << 31 - 20)
#define CPC0_CR0_DTE (1 << 31 - 21)
#define CPC0_CR0_DRE (1 << 31 - 22)
#define CPC0_CR0_DAEC (1 << 31 - 23)
#define CPC0_CR0_U0EC (1 << 31 - 24)
#define CPC0_CR0_U1EC (1 << 31 - 25)
Maybe you can quickly translate IBM's bit 4 into 0x0800'0000 but I cannot,
certainly not reliably.