Upgrade Bullet to version 2.83.
[blender.git] / extern / bullet2 / src / LinearMath / btAlignedObjectArray.h
index 24e59ab65d7418e3951129a2dd35c88b8d60ce3d..6193ef7f42742edad41cbba2f99c1f56da2a51d0 100644 (file)
@@ -39,6 +39,12 @@ subject to the following restrictions:
 #include <new> //for placement new
 #endif //BT_USE_PLACEMENT_NEW
 
+// The register keyword is deprecated in C++11 so don't use it.
+#if __cplusplus > 199711L
+#define BT_REGISTER
+#else
+#define BT_REGISTER register
+#endif
 
 ///The btAlignedObjectArray template class uses a subset of the stl::vector interface for its methods
 ///It is developed to replace stl::vector to avoid portability issues, including STL alignment issues to add SIMD/SSE data
@@ -202,24 +208,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 BT_REGISTER int curSize = size();
 
                        if (newsize < curSize)
                        {
@@ -229,7 +227,7 @@ protected:
                                }
                        } else
                        {
-                               if (newsize > size())
+                               if (newsize > curSize)
                                {
                                        reserve(newsize);
                                }
@@ -246,7 +244,7 @@ protected:
                }
                SIMD_FORCE_INLINE       T&  expandNonInitializing( )
                {       
-                       int sz = size();
+                       const BT_REGISTER int sz = size();
                        if( sz == capacity() )
                        {
                                reserve( allocSize(size()) );
@@ -259,7 +257,7 @@ protected:
 
                SIMD_FORCE_INLINE       T&  expand( const T& fillValue=T())
                {       
-                       int sz = size();
+                       const BT_REGISTER int sz = size();
                        if( sz == capacity() )
                        {
                                reserve( allocSize(size()) );
@@ -275,7 +273,7 @@ protected:
 
                SIMD_FORCE_INLINE       void push_back(const T& _Val)
                {       
-                       int sz = size();
+                       const BT_REGISTER int sz = size();
                        if( sz == capacity() )
                        {
                                reserve( allocSize(size()) );