ALIGN_UP
Description
Aligns the given value up to the nearest multiple of alignment.
Parameters
| Name | Direction | Description |
|---|---|---|
value |
in | The value to be aligned up. |
alignment |
in | The alignment boundary. |
Success
Returns aligned-up value when alignment > 1, original value otherwise.
Failure
Function cannot fail - always returns a valid value.
Usage example (Cross-references)
Usage examples (Cross-references)
- In
Vec.Access.c:245:
// For 8-byte alignment, each int (4 bytes) should be padded to 8 bytes
size aligned_size = ALIGN_UP(sizeof(int), 8);
// Check offsets with alignment
- In
Access.h:42:
///
#define IterDataAt(mi, idx) \
((ITER_DATA_TYPE(mi) *)(((u8 *)(mi)->data) + (idx) * ALIGN_UP(sizeof(ITER_DATA_TYPE(mi)), (mi)->alignment)))
///
- In
Access.h:78:
/// TAGS: Memory, Size, Iter
///
#define IterSize(mi) (IterLength(mi) * ALIGN_UP(sizeof(ITER_DATA_TYPE(mi)), (mi)->alignment))
///
- In
Access.h:85:
/// TAGS: Memory, Iter, Size
///
#define IterRemainingSize(mi) (IterRemainingLength(mi) * ALIGN_UP(sizeof(ITER_DATA_TYPE(mi)), (mi)->alignment))
///
- In
Access.h:96:
(IterRemainingLength(mi) ? \
(ITER_DATA_TYPE(mi) *)(((u64)(mi)->data) + \
(mi)->pos * ALIGN_UP(sizeof(ITER_DATA_TYPE(mi)), (mi)->alignment)) : \
NULL_ITER_DATA(mi))
Last updated on