On 5/15/23 08:45, Pedro Falcato wrote:
-#define ALIGN_VALUE_ADDEND(Value, Alignment) (((Alignment) - (Value)) &
((Alignment) - 1U))
+#define ALIGN_VALUE_ADDEND(Value, Alignment) ((~(Value)) & ((Alignment) - 1U))
/**
Rounds a value up to the next boundary using a specified alignment.
@@ -945,7 +945,7 @@ STATIC_ASSERT (ALIGNOF (__VERIFY_INT32_ENUM_SIZE) == sizeof
(__VERIFY_INT32_ENUM
@return A value up to the next boundary.
**/
-#define ALIGN_VALUE(Value, Alignment) ((Value) + ALIGN_VALUE_ADDEND (Value,
Alignment))
+#define ALIGN_VALUE(Value, Alignment) (((Value) + (Alignment - 1)) &
~(Alignment))
Since ALIGN_VALUE_ADDEND is only used in ALIGN_VALUE, it should probably
be deleted instead of updated.
--
Rebecca Cran
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#104885): https://edk2.groups.io/g/devel/message/104885
Mute This Topic: https://groups.io/mt/98904940/21656
Group Owner: [email protected]
Unsubscribe: https://edk2.groups.io/g/devel/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-