Hi Peter, On 08.01.21 01:12, Peter Stuge wrote: > Felix Held wrote: >> While I find the BIT() macro to be much better than the BITx defines > > Why?
for me it's that the BITx defines provide no separation between the BIT and the number. Also, the all-caps BIT letters come close to decimal digits; e.g. try to read BIT118 without losing focus (yeah, that's an exaggerated example). BIT(118) would make the number more distinct and I believe 1 << 118 even more. EDK code just makes this problem very visible with expressions like (BIT17|BIT8|BIT1) (yes, let's donate them some whitespace) >> header files become a mix of BIT() and more than one bit shifted by x >> bits, which i find inconsistent and try to avoid. > > I don't mind those being "inconsistent" because they represent two > different things; one is a single bit value, the other a multibit value. Just to clarify (I hope), I guess what Felix wants to avoid are single expressions that mix both, e.g. something like something = BIT(13) | 3 << 3 | BIT(0); And I agree, I would prefer to just use `1 << x` here. Nico _______________________________________________ coreboot mailing list -- coreboot@coreboot.org To unsubscribe send an email to coreboot-le...@coreboot.org