BudgetAllocatorInitAligned
Description
Initialize a BudgetAllocator with an alignment floor. Slot size is rounded up to the larger of alignment and sizeof(void *), and the first slot is positioned so that every slot satisfies the requested alignment.
Parameters
| Name | Direction | Description |
|---|---|---|
alignment |
in | Required slot alignment in bytes (power of two). |
Usage example (Cross-references)
Usage examples (Cross-references)
static u8 buf[1024];
MemSet(buf, 0, sizeof(buf));
BudgetAllocator bp = BudgetAllocatorInitAligned(buf, sizeof(buf), sizeof(int), 64);
Allocator *alloc = ALLOCATOR_OF(&bp);
int *p1 = (int *)AllocatorAlloc(alloc, sizeof(int), true);- In
Budget.c:139:
}
BudgetAllocator BudgetAllocatorInitAligned(void *buf, size buf_bytes, size slot_size, size alignment) {
return budget_build(buf, buf_bytes, slot_size, alignment);
}
Last updated on