49 virtual void** allocate(PxU32 capacity)
51 PX_ASSERT(PxIsPowerOfTwo(capacity));
55 return capacity<=4 ? reinterpret_cast<void**>(mPool4.construct())
56 : capacity<=16 ? reinterpret_cast<void**>(mPool16.construct())
57 : capacity<=64 ? reinterpret_cast<void**>(mPool64.construct())
58 :
reinterpret_cast<void**
>(PX_ALLOC(capacity*
sizeof(
void*),
"CmPtrTable pointer array"));
61 virtual void deallocate(
void** addr, PxU32 capacity)
63 PX_ASSERT(PxIsPowerOfTwo(capacity));
67 if(capacity<=4) mPool4.destroy(
reinterpret_cast< PtrBlock<4>*
>(addr));
68 else if(capacity<=16) mPool16.destroy(
reinterpret_cast< PtrBlock<16>*
>(addr));
69 else if(capacity<=64) mPool64.destroy(
reinterpret_cast< PtrBlock<64>*
>(addr));
76 virtual bool canReuse(PxU32 originalCapacity, PxU32 newCapacity)
78 PX_ASSERT(PxIsPowerOfTwo(originalCapacity));
79 PX_ASSERT(PxIsPowerOfTwo(newCapacity));
81 return poolId(originalCapacity) == poolId(newCapacity) && newCapacity<=64;
88 int poolId(PxU32 size)
96 template<
int N>
class PtrBlock {
void* ptr[N]; };
Sorts an array of objects in ascending order, assuming that the predicate implements the < operator:
Definition PxBoxController.h:39