diff --git a/src/LinearMath/btAlignedObjectArray.h b/src/LinearMath/btAlignedObjectArray.h index 24e59ab65..db1864803 100644 --- a/src/LinearMath/btAlignedObjectArray.h +++ b/src/LinearMath/btAlignedObjectArray.h @@ -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()) );