Skip to content

cf_aligned_alloc

Category: allocator
GitHub: cute_alloc.h


Allocates a block of memory aligned along a byte boundary.

void* cf_aligned_alloc(size_t size, int alignment);
Parameters Description
size The size of the allocation.
alignment An alignment boundary, must be a power of two.

Return Value

Returns an aligned pointer of size bytes.

Remarks

Aligned allocation is mostly useful as a performance optimization, or for SIMD operations that require byte alignments.

cf_aligned_free