make sure aligned structures/classes use the btAlignedAlloc/btAlignedFree, by overriding the operator new/delete for that struct/class.

integrated some contributions from IBM Germany for libspe2
This commit is contained in:
ejcoumans
2007-09-25 06:41:57 +00:00
parent 12e2a5c57c
commit a38de566c6
42 changed files with 1859 additions and 1814 deletions

View File

@@ -17,6 +17,7 @@ subject to the following restrictions:
#define _BT_POOL_ALLOCATOR_H
#include "btScalar.h"
#include "btAlignedAllocator.h"
class btPoolAllocator
{
@@ -32,7 +33,7 @@ public:
:m_elemSize(elemSize),
m_maxElements(maxElements)
{
m_pool = new unsigned char[m_elemSize*m_maxElements];
m_pool = (unsigned char*) btAlignedAlloc(m_elemSize*m_maxElements,16);
unsigned char* p = m_pool;
m_firstFree = p;
@@ -47,7 +48,7 @@ public:
~btPoolAllocator()
{
delete m_pool;
btAlignedFree( m_pool);
}
void* allocate(int size)