mirror of
https://github.com/acidanthera/audk.git
synced 2025-07-27 07:34:06 +02:00
MdePkg/Base.h: Introduce ALIGN_VALUE_SUBTRAHEND
This commit is contained in:
parent
5a4fbc3aa4
commit
750a6dec00
@ -907,6 +907,17 @@ STATIC_ASSERT (ALIGNOF (__VERIFY_INT32_ENUM_SIZE) == sizeof (__VERIFY_INT32_ENUM
|
|||||||
**/
|
**/
|
||||||
#define IS_POW2(Value) ((Value) != 0U && ((Value) & ((Value) - 1U)) == 0U)
|
#define IS_POW2(Value) ((Value) != 0U && ((Value) & ((Value) - 1U)) == 0U)
|
||||||
|
|
||||||
|
/**
|
||||||
|
Determines the subtrahend to subtract from a value to round it down to the
|
||||||
|
previous boundary of a specified alignment.
|
||||||
|
|
||||||
|
@param Value The value to round down.
|
||||||
|
@param Alignment The alignment boundary used to return the subtrahend.
|
||||||
|
|
||||||
|
@return Subtrahend to round Value down to alignment boundary Alignment.
|
||||||
|
**/
|
||||||
|
#define ALIGN_VALUE_SUBTRAHEND(Value, Alignment) ((Value) & ((Alignment) - 1U))
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Checks whether a value is aligned by a specified alignment.
|
Checks whether a value is aligned by a specified alignment.
|
||||||
|
|
||||||
@ -916,7 +927,7 @@ STATIC_ASSERT (ALIGNOF (__VERIFY_INT32_ENUM_SIZE) == sizeof (__VERIFY_INT32_ENUM
|
|||||||
@retval TRUE Value is aligned by Alignment.
|
@retval TRUE Value is aligned by Alignment.
|
||||||
@retval FALSE Value is not aligned by Alignment.
|
@retval FALSE Value is not aligned by Alignment.
|
||||||
**/
|
**/
|
||||||
#define IS_ALIGNED(Value, Alignment) (((Value) & ((Alignment) - 1U)) == 0U)
|
#define IS_ALIGNED(Value, Alignment) (ALIGN_VALUE_SUBTRAHEND (Value, Alignment) == 0U)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Checks whether a pointer or address is aligned by a specified alignment.
|
Checks whether a pointer or address is aligned by a specified alignment.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user