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:
authorTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>2012-06-11 00:50:43 +0400
committerTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>2012-06-11 00:50:43 +0400
commit8135cc9f954e0d63ab3e97d4a7c52ff5e573eef0 (patch)
treea12ec0daccfc45b7e3c68e4a2d7099655daf619d /extern/bullet2/src/LinearMath/btAlignedObjectArray.h
parent0f33d5719fd0adc666e7e92e0f062281f4285f13 (diff)
parent298feff39006c14aa28b5e0232aa7ed70a83a496 (diff)
Merged changes in the trunk up to revision 47700.
Conflicts resolved: source/blender/blenkernel/BKE_main.h source/blender/blenkernel/CMakeLists.txt source/blender/blenkernel/intern/library.c source/blender/blenloader/intern/readfile.c source/blender/blenloader/intern/writefile.c source/blender/editors/interface/resources.c source/blender/makesdna/DNA_ID.h source/blender/makesdna/DNA_action_types.h source/blender/makesdna/intern/makesdna.c source/blender/makesrna/SConscript source/blender/makesrna/intern/rna_internal.h source/blender/makesrna/intern/rna_main.c source/blender/makesrna/intern/rna_main_api.c source/blender/windowmanager/WM_types.h
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;