37 #if defined (BT_HAS_ALIGNED_ALLOCATOR)
41 return _aligned_malloc(size, (
size_t)alignment);
48 #elif defined(__CELLOS_LV2__)
70 real = (
char *)
sAllocFunc(size +
sizeof(
void *) + (alignment-1));
73 *((
void **)(ret)-1) = (
void *)(real);
85 real = *((
void **)(ptr)-1);
107 #ifdef BT_DEBUG_MEMORY_ALLOCATIONS
120 real = (
char *)
sAllocFunc(size + 2*
sizeof(
void *) + (alignment-1));
123 *((
void **)(ret)-1) = (
void *)(real);
124 *((
int*)(ret)-2) = size;
127 ret = (
void *)(real);
130 printf(
"allocation#%d at address %x, from %s,line %d, size %d\n",
gNumAlignedAllocs,real, filename,line,size);
132 int* ptr = (
int*)ret;
144 real = *((
void **)(ptr)-1);
145 int size = *((
int*)(ptr)-2);
148 printf(
"free #%d at address %x, from %s,line %d, size %d\n",
gNumAlignedFree,real, filename,line,size);
153 printf(
"NULL ptr\n");
157 #else //BT_DEBUG_MEMORY_ALLOCATIONS
180 #endif //BT_DEBUG_MEMORY_ALLOCATIONS