diff options
Diffstat (limited to 'extern/bullet2/src/LinearMath/btAlignedObjectArray.h')
-rw-r--r-- | extern/bullet2/src/LinearMath/btAlignedObjectArray.h | 35 |
1 files changed, 32 insertions, 3 deletions
diff --git a/extern/bullet2/src/LinearMath/btAlignedObjectArray.h b/extern/bullet2/src/LinearMath/btAlignedObjectArray.h index bad1eee1f63..955bb128e83 100644 --- a/extern/bullet2/src/LinearMath/btAlignedObjectArray.h +++ b/extern/bullet2/src/LinearMath/btAlignedObjectArray.h @@ -138,6 +138,16 @@ class btAlignedObjectArray return m_size; } + SIMD_FORCE_INLINE const T& at(int n) const + { + return m_data[n]; + } + + SIMD_FORCE_INLINE T& at(int n) + { + return m_data[n]; + } + SIMD_FORCE_INLINE const T& operator[](int n) const { return m_data[n]; @@ -171,9 +181,9 @@ class btAlignedObjectArray { int curSize = size(); - if (newsize < size()) + if (newsize < curSize) { - for(int i = curSize; i < newsize; i++) + for(int i = newsize; i < curSize; i++) { m_data[i].~T(); } @@ -195,6 +205,18 @@ class btAlignedObjectArray m_size = newsize; } + SIMD_FORCE_INLINE T& expandNonInitializing( ) + { + int sz = size(); + if( sz == capacity() ) + { + reserve( allocSize(size()) ); + } + m_size++; + + return m_data[sz]; + } + SIMD_FORCE_INLINE T& expand( const T& fillValue=T()) { @@ -384,7 +406,7 @@ class btAlignedObjectArray int findBinarySearch(const T& key) const { int first = 0; - int last = size(); + int last = size()-1; //assume sorted array while (first <= last) { @@ -437,6 +459,13 @@ class btAlignedObjectArray m_capacity = capacity; } + void copyFromArray(const btAlignedObjectArray& otherArray) + { + int otherSize = otherArray.size(); + resize (otherSize); + otherArray.copy(0, otherSize, m_data); + } + }; #endif //BT_OBJECT_ARRAY__ |