Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'extern/bullet2/src/LinearMath/btAlignedAllocator.cpp')
-rw-r--r--extern/bullet2/src/LinearMath/btAlignedAllocator.cpp15
1 files changed, 7 insertions, 8 deletions
diff --git a/extern/bullet2/src/LinearMath/btAlignedAllocator.cpp b/extern/bullet2/src/LinearMath/btAlignedAllocator.cpp
index 189b759d237..c4c0ceb2ed2 100644
--- a/extern/bullet2/src/LinearMath/btAlignedAllocator.cpp
+++ b/extern/bullet2/src/LinearMath/btAlignedAllocator.cpp
@@ -58,16 +58,18 @@ static inline void btAlignedFreeDefault(void *ptr)
free(ptr);
}
#else
+
+
+
+
+
static inline void *btAlignedAllocDefault(size_t size, int alignment)
{
void *ret;
char *real;
- unsigned long offset;
-
real = (char *)sAllocFunc(size + sizeof(void *) + (alignment-1));
if (real) {
- offset = (alignment - (unsigned long)(real + sizeof(void *))) & (alignment-1);
- ret = (void *)((real + sizeof(void *)) + offset);
+ ret = btAlignPointer(real + sizeof(void *),alignment);
*((void **)(ret)-1) = (void *)(real);
} else {
ret = (void *)(real);
@@ -110,7 +112,6 @@ void* btAlignedAllocInternal (size_t size, int alignment,int line,char* filen
{
void *ret;
char *real;
- unsigned long offset;
gTotalBytesAlignedAllocs += size;
gNumAlignedAllocs++;
@@ -118,9 +119,7 @@ void* btAlignedAllocInternal (size_t size, int alignment,int line,char* filen
real = (char *)sAllocFunc(size + 2*sizeof(void *) + (alignment-1));
if (real) {
- offset = (alignment - (unsigned long)(real + 2*sizeof(void *))) &
-(alignment-1);
- ret = (void *)((real + 2*sizeof(void *)) + offset);
+ ret = (void*) btAlignPointer((real + 2*sizeof(void *), alignment);
*((void **)(ret)-1) = (void *)(real);
*((int*)(ret)-2) = size;