Optimizations (#168)
- Optimize contact prepare - Back to post restitution stage - Optimize solver math - Bug fixes
This commit is contained in:
parent
9e5a4cde86
commit
79fc55976a
55 changed files with 3248 additions and 1519 deletions
|
|
@ -10,8 +10,8 @@ b3BlockAllocator b3CreateBlockAllocator( int elementSize, int initialCount )
|
|||
B3_ASSERT( elementSize >= (int)sizeof( void* ) );
|
||||
|
||||
// The free list stores a pointer inside each element, so the stride must keep every element aligned.
|
||||
// Blocks come from b3Alloc, so a stride that is a multiple of B3_ALIGNMENT aligns all elements.
|
||||
elementSize = ( ( elementSize - 1 ) | ( B3_ALIGNMENT - 1 ) ) + 1;
|
||||
// Blocks come from b3Alloc, so a stride that is a multiple of B3_BLOCK_ALIGNMENT aligns all elements.
|
||||
elementSize = ( ( elementSize - 1 ) | ( B3_BLOCK_ALIGNMENT - 1 ) ) + 1;
|
||||
|
||||
b3BlockAllocator allocator = { 0 };
|
||||
|
||||
|
|
@ -85,7 +85,7 @@ void b3FreeElement( b3BlockAllocator* allocator, void* element )
|
|||
B3_ASSERT( allocator != NULL );
|
||||
B3_ASSERT( element != NULL );
|
||||
B3_ASSERT( allocator->allocationCount > 0 );
|
||||
B3_ASSERT( ( (uintptr_t)element & ( B3_ALIGNMENT - 1 ) ) == 0 );
|
||||
B3_ASSERT( ( (uintptr_t)element & ( B3_BLOCK_ALIGNMENT - 1 ) ) == 0 );
|
||||
|
||||
allocator->allocationCount -= 1;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue