llvm.org GIT mirror llvm / 5232f41
Fix unit test on FreeBSD. We need to make sure there is enough space to save the pointer even if the memory returned from malloc was already aligned. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78805 91177308-0d34-0410-b5e6-96231b3b80d8 Benjamin Kramer 10 years ago
1 changed file(s) with 1 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
107107 void *MemBase = malloc(Size + Alignment - 1 + sizeof(void*));
108108
109109 // Make the slab.
110 MemSlab *Slab = (MemSlab*)(((uintptr_t)MemBase + Alignment - 1) &
110 MemSlab *Slab = (MemSlab*)(((uintptr_t)MemBase+sizeof(void*)+Alignment-1) &
111111 ~(uintptr_t)(Alignment - 1));
112112 Slab->Size = Size;
113113 Slab->NextPtr = 0;