- Timestamp:
- Feb 27, 2011, 7:43:24 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/kicklib/src/external/bullet/LinearMath/btAlignedAllocator.cpp
r5781 r7983 161 161 { 162 162 gNumAlignedAllocs++; 163 void* ptr; 164 #if defined (BT_HAS_ALIGNED_ALLOCATOR) || defined(__CELLOS_LV2__) 163 void* ptr; 165 164 ptr = sAlignedAllocFunc(size, alignment); 166 #else167 char *real;168 unsigned long offset;169 170 real = (char *)sAllocFunc(size + sizeof(void *) + (alignment-1));171 if (real) {172 offset = (alignment - (unsigned long)(real + sizeof(void *))) & (alignment-1);173 ptr = (void *)((real + sizeof(void *)) + offset);174 *((void **)(ptr)-1) = (void *)(real);175 } else {176 ptr = (void *)(real);177 }178 #endif // defined (BT_HAS_ALIGNED_ALLOCATOR) || defined(__CELLOS_LV2__)179 165 // printf("btAlignedAllocInternal %d, %x\n",size,ptr); 180 166 return ptr; … … 190 176 gNumAlignedFree++; 191 177 // printf("btAlignedFreeInternal %x\n",ptr); 192 #if defined (BT_HAS_ALIGNED_ALLOCATOR) || defined(__CELLOS_LV2__)193 178 sAlignedFreeFunc(ptr); 194 #else195 void* real;196 197 if (ptr) {198 real = *((void **)(ptr)-1);199 sFreeFunc(real);200 }201 #endif // defined (BT_HAS_ALIGNED_ALLOCATOR) || defined(__CELLOS_LV2__)202 179 } 203 180
Note: See TracChangeset
for help on using the changeset viewer.