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/btStackAlloc.h')
-rw-r--r--extern/bullet2/src/LinearMath/btStackAlloc.h19
1 files changed, 14 insertions, 5 deletions
diff --git a/extern/bullet2/src/LinearMath/btStackAlloc.h b/extern/bullet2/src/LinearMath/btStackAlloc.h
index d219b453537..050d44bdfe9 100644
--- a/extern/bullet2/src/LinearMath/btStackAlloc.h
+++ b/extern/bullet2/src/LinearMath/btStackAlloc.h
@@ -21,6 +21,7 @@ Nov.2006
#define BT_STACK_ALLOC
#include "btScalar.h" //for btAssert
+#include "btAlignedAllocator.h"
struct btBlock
{
@@ -28,7 +29,7 @@ struct btBlock
unsigned char* address;
};
-///StackAlloc provides some fast stack-based memory allocator (LIFO last-in first-out)
+///The StackAlloc class provides some fast stack-based memory allocator (LIFO last-in first-out)
class btStackAlloc
{
public:
@@ -39,7 +40,7 @@ public:
inline void create(unsigned int size)
{
destroy();
- data = new unsigned char[size];
+ data = (unsigned char*) btAlignedAlloc(size,16);
totalsize = size;
}
inline void destroy()
@@ -49,12 +50,20 @@ public:
if(usedsize==0)
{
- if(!ischild) delete[] data;
+ if(!ischild && data)
+ btAlignedFree(data);
+
data = 0;
usedsize = 0;
}
}
+
+ int getAvailableMemory() const
+ {
+ return static_cast<int>(totalsize - usedsize);
+ }
+
unsigned char* allocate(unsigned int size)
{
const unsigned int nus(usedsize+size);
@@ -68,7 +77,7 @@ public:
return(0);
}
- inline btBlock* beginBlock()
+ SIMD_FORCE_INLINE btBlock* beginBlock()
{
btBlock* pb = (btBlock*)allocate(sizeof(btBlock));
pb->previous = current;
@@ -76,7 +85,7 @@ public:
current = pb;
return(pb);
}
- inline void endBlock(btBlock* block)
+ SIMD_FORCE_INLINE void endBlock(btBlock* block)
{
btAssert(block==current);
//Raise(L"Unmatched blocks");