Hi, Although, I agree that 1u << 31 is much better, I believe 1 << 31 is not wrong either as long as it is assigned to an 'unsigned int' as the compiler performs an implicit conversion from a lower data type to a higher data type ('int' to 'unsigned int' in this case). That's the reason the line "return *shadow_addr" at lib/asan.c:89 (that Shawn talked about in the previous thread) seems correct to me as 'unsigned char' is being implicitly converted to 'bool'.
Best, Harshit On Thu, Jan 7, 2021 at 4:28 PM Felix Held <felix-coreb...@felixheld.de> wrote: > >> While I find the BIT() macro to be much better than the BITx defines > > > > Why? > > The BITx defines seem to be a rather redundant way of doing things to me. > > > I don't think it was invented by edk2, so edk2 using it shouldn't be > > held against the format. :) > > Sure, but that's where I remember seeing those defines in coreboot [1]. > > > I don't mind those being "inconsistent" because they represent two > > different things; one is a single bit value, the other a multibit value. > > When you have a register with single bit values and multibit values > which is a very common case, I prefer having both in the same > style/format. At least for me this improves readability. > > > There could of course be a multibit macro, but the benefit diminishes > > because the macro is neither shorter nor simpler than the expansion. > > Yeah, that would likely also be bad for readability. > > Regards, > Felix > > [1] > > https://review.coreboot.org/plugins/gitiles/coreboot/+/refs/heads/master/src/vendorcode/intel/edk2/UDK2017/MdePkg/Include/Base.h#400 > _______________________________________________ > coreboot mailing list -- coreboot@coreboot.org > To unsubscribe send an email to coreboot-le...@coreboot.org >
_______________________________________________ coreboot mailing list -- coreboot@coreboot.org To unsubscribe send an email to coreboot-le...@coreboot.org