Marvin, So lucky to have you in the edk2 project looking into these fundamentals!
+ #define ALIGNOF(TYPE) OFFSET_OF (struct { CHAR8 C; TYPE A; }, A) 1. Does struct{} inside a macro conform to C standard? How is the compatibility with different compilers? +#define IS_POW2(Value) ((Value) != 0U && ((Value) & ((Value) - 1U)) == +0U) 2. Good to me. I learned this trick when implementing the MtrrLib. +#define ALIGN_VALUE_ADDEND(Value, Alignment) (((Alignment) - (Value)) +& ((Alignment) - 1U)) 3. Is any other open source project using the same macro for the addend? This is actually a general question to all new macros. I would like the macros look familiar to developers from other open source projects. -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#79344): https://edk2.groups.io/g/devel/message/79344 Mute This Topic: https://groups.io/mt/84909448/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-