Lines Matching full:alignment
34 // Ok reference on memory alignment:
35 // http://stackoverflow.com/questions/227897/solve-the-memory-alignment-in-c-interview-question-tha…
48 void* AlignedMalloc(size_t size, size_t alignment) in AlignedMalloc() argument
50 if(alignment == 0) in AlignedMalloc()
52 // Don't allow alignment 0 since it's undefined. in AlignedMalloc()
55 // Make sure that the alignment is an integer power of two or fail. in AlignedMalloc()
56 if(alignment & (alignment - 1)) in AlignedMalloc()
68 // alignment - 1 bytes needs to be allocated. in AlignedMalloc()
72 alignment - 1); in AlignedMalloc()
84 // The buffer should be aligned with 'alignment' bytes. The - 1 guarantees in AlignedMalloc()
86 uintptr_t alignedPos = (alignStartPos + alignment - 1) & ~(alignment - 1); in AlignedMalloc()