1
0
mirror of https://github.com/bulletphysics/bullet3 synced 2024-12-14 22:00:05 +00:00

Simple Improve Array

This commit is contained in:
donggas90 2015-06-08 13:40:23 +09:00
parent 96d9e54080
commit a3b41fdcb9

View File

@ -202,24 +202,16 @@ protected:
///when the new number of elements is smaller, the destructor will be called, but memory will not be freed, to reduce performance overhead of run-time memory (de)allocations.
SIMD_FORCE_INLINE void resizeNoInitialize(int newsize)
{
int curSize = size();
if (newsize < curSize)
if (newsize > size())
{
} else
{
if (newsize > size())
{
reserve(newsize);
}
//leave this uninitialized
reserve(newsize);
}
m_size = newsize;
}
SIMD_FORCE_INLINE void resize(int newsize, const T& fillData=T())
{
int curSize = size();
const register int curSize = size();
if (newsize < curSize)
{
@ -229,7 +221,7 @@ protected:
}
} else
{
if (newsize > size())
if (newsize > curSize)
{
reserve(newsize);
}
@ -246,7 +238,7 @@ protected:
}
SIMD_FORCE_INLINE T& expandNonInitializing( )
{
int sz = size();
const register int sz = size();
if( sz == capacity() )
{
reserve( allocSize(size()) );
@ -259,7 +251,7 @@ protected:
SIMD_FORCE_INLINE T& expand( const T& fillValue=T())
{
int sz = size();
const register int sz = size();
if( sz == capacity() )
{
reserve( allocSize(size()) );
@ -275,7 +267,7 @@ protected:
SIMD_FORCE_INLINE void push_back(const T& _Val)
{
int sz = size();
const register int sz = size();
if( sz == capacity() )
{
reserve( allocSize(size()) );