ChibiOS/RT
5.1.0
|
Memory alignment support macros | |
#define | MEM_ALIGN_MASK(a) ((size_t)(a) - 1U) |
Alignment mask constant. More... | |
#define | MEM_ALIGN_PREV(p, a) |
Aligns to the previous aligned memory address. More... | |
#define | MEM_ALIGN_NEXT(p, a) |
Aligns to the next aligned memory address. More... | |
#define | MEM_IS_ALIGNED(p, a) (((size_t)(p) & MEM_ALIGN_MASK(a)) == 0U) |
Returns whatever a pointer or memory size is aligned. More... | |
#define | MEM_IS_VALID_ALIGNMENT(a) (((size_t)(a) != 0U) && (((size_t)(a) & ((size_t)(a) - 1U)) == 0U)) |
Returns whatever a constant is a valid alignment. More... | |
#define MEM_ALIGN_MASK | ( | a | ) | ((size_t)(a) - 1U) |
Alignment mask constant.
[in] | a | alignment, must be a power of two |
Definition at line 59 of file chalign.h.
Referenced by chPoolFreeI().
#define MEM_ALIGN_PREV | ( | p, | |
a | |||
) |
Aligns to the previous aligned memory address.
[in] | p | variable to be aligned |
[in] | a | alignment, must be a power of two |
#define MEM_ALIGN_NEXT | ( | p, | |
a | |||
) |
Aligns to the next aligned memory address.
[in] | p | variable to be aligned |
[in] | a | alignment, must be a power of two |
Definition at line 78 of file chalign.h.
Referenced by chCoreAllocAlignedWithOffsetI(), chHeapAllocAligned(), chHeapFree(), chHeapObjectInit(), chThdCreateStatic(), and chThdCreateSuspendedI().
#define MEM_IS_ALIGNED | ( | p, | |
a | |||
) | (((size_t)(p) & MEM_ALIGN_MASK(a)) == 0U) |
Returns whatever a pointer or memory size is aligned.
[in] | p | variable to be aligned |
[in] | a | alignment, must be a power of two |
Definition at line 89 of file chalign.h.
Referenced by chHeapFree(), chThdCreateStatic(), and chThdCreateSuspendedI().
#define MEM_IS_VALID_ALIGNMENT | ( | a | ) | (((size_t)(a) != 0U) && (((size_t)(a) & ((size_t)(a) - 1U)) == 0U)) |
Returns whatever a constant is a valid alignment.
Valid alignments are powers of two.
[in] | a | alignment to be checked, must be a constant |
Definition at line 97 of file chalign.h.
Referenced by chCoreAllocAlignedWithOffsetI(), and chHeapAllocAligned().