Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergej Reich <sergej.reich@googlemail.com>2012-06-08 20:13:01 +0400
committerSergej Reich <sergej.reich@googlemail.com>2012-06-08 20:13:01 +0400
commit82d3d9f2ba47bbf2f868b5a970d1fe149eba13e2 (patch)
treee99d947080f8e787059d86500f01dd6c1ad616e4 /extern/bullet2/src/LinearMath/btAlignedObjectArray.h
parent221a7878223e983372ba830e4ca1a17067abf2ba (diff)
Update Bullet to version 2.80 (bullet svn revision 2537)
Remove Jamfiles and other unused files that stuck around during previous updates. Add patches for local changes to the patches directory. Update readme.txt, it had outdated infromation.
Diffstat (limited to 'extern/bullet2/src/LinearMath/btAlignedObjectArray.h')
-rw-r--r--extern/bullet2/src/LinearMath/btAlignedObjectArray.h33
1 files changed, 28 insertions, 5 deletions
diff --git a/extern/bullet2/src/LinearMath/btAlignedObjectArray.h b/extern/bullet2/src/LinearMath/btAlignedObjectArray.h
index 955bb128e83..36090e13c89 100644
--- a/extern/bullet2/src/LinearMath/btAlignedObjectArray.h
+++ b/extern/bullet2/src/LinearMath/btAlignedObjectArray.h
@@ -28,6 +28,7 @@ subject to the following restrictions:
#define BT_USE_PLACEMENT_NEW 1
//#define BT_USE_MEMCPY 1 //disable, because it is cumbersome to find out for each platform where memcpy is defined. It can be in <memory.h> or <string.h> or otherwise...
+#define BT_ALLOW_ARRAY_COPY_OPERATOR // enabling this can accidently perform deep copies of data if you are not careful
#ifdef BT_USE_MEMCPY
#include <memory.h>
@@ -53,7 +54,19 @@ class btAlignedObjectArray
//PCK: added this line
bool m_ownsMemory;
- protected:
+#ifdef BT_ALLOW_ARRAY_COPY_OPERATOR
+public:
+ SIMD_FORCE_INLINE btAlignedObjectArray<T>& operator=(const btAlignedObjectArray<T> &other)
+ {
+ copyFromArray(other);
+ return *this;
+ }
+#else//BT_ALLOW_ARRAY_COPY_OPERATOR
+private:
+ SIMD_FORCE_INLINE btAlignedObjectArray<T>& operator=(const btAlignedObjectArray<T> &other);
+#endif//BT_ALLOW_ARRAY_COPY_OPERATOR
+
+protected:
SIMD_FORCE_INLINE int allocSize(int size)
{
return (size ? size*2 : 1);
@@ -140,21 +153,29 @@ class btAlignedObjectArray
SIMD_FORCE_INLINE const T& at(int n) const
{
+ btAssert(n>=0);
+ btAssert(n<size());
return m_data[n];
}
SIMD_FORCE_INLINE T& at(int n)
{
+ btAssert(n>=0);
+ btAssert(n<size());
return m_data[n];
}
SIMD_FORCE_INLINE const T& operator[](int n) const
{
+ btAssert(n>=0);
+ btAssert(n<size());
return m_data[n];
}
SIMD_FORCE_INLINE T& operator[](int n)
{
+ btAssert(n>=0);
+ btAssert(n<size());
return m_data[n];
}
@@ -171,6 +192,7 @@ class btAlignedObjectArray
SIMD_FORCE_INLINE void pop_back()
{
+ btAssert(m_size>0);
m_size--;
m_data[m_size].~T();
}
@@ -291,8 +313,9 @@ class btAlignedObjectArray
}
};
+
template <typename L>
- void quickSortInternal(L CompareFunc,int lo, int hi)
+ void quickSortInternal(const L& CompareFunc,int lo, int hi)
{
// lo is the lower index, hi is the upper index
// of the region of array a that is to be sorted
@@ -322,7 +345,7 @@ class btAlignedObjectArray
template <typename L>
- void quickSort(L CompareFunc)
+ void quickSort(const L& CompareFunc)
{
//don't sort 0 or 1 elements
if (size()>1)
@@ -334,7 +357,7 @@ class btAlignedObjectArray
///heap sort from http://www.csse.monash.edu.au/~lloyd/tildeAlgDS/Sort/Heap/
template <typename L>
- void downHeap(T *pArr, int k, int n,L CompareFunc)
+ void downHeap(T *pArr, int k, int n, const L& CompareFunc)
{
/* PRE: a[k+1..N] is a heap */
/* POST: a[k..N] is a heap */
@@ -380,7 +403,7 @@ class btAlignedObjectArray
}
template <typename L>
- void heapSort(L CompareFunc)
+ void heapSort(const L& CompareFunc)
{
/* sort a[0..N-1], N.B. 0 to N-1 */
int k;