diff options
author | Graham Madarasz <graham@lindenlab.com> | 2013-03-11 12:30:16 -0700 |
---|---|---|
committer | Graham Madarasz <graham@lindenlab.com> | 2013-03-11 12:30:16 -0700 |
commit | c04f4f66c813181eb378b00045aec969dc2c4aae (patch) | |
tree | 3e1473f121b8d80f55968aee03db7b5e99f644cb /indra/llmath/llvolume.cpp | |
parent | b628518fd7c2ee6432dd2f49ecf192bd26455dba (diff) |
Moved LLAlignedArray from llmath to llcommon and put template func impls in header to work around Mac 4.3.3 link issue.
Diffstat (limited to 'indra/llmath/llvolume.cpp')
-rw-r--r-- | indra/llmath/llvolume.cpp | 87 |
1 files changed, 0 insertions, 87 deletions
diff --git a/indra/llmath/llvolume.cpp b/indra/llmath/llvolume.cpp index 9fc72fd801..4f3e753276 100644 --- a/indra/llmath/llvolume.cpp +++ b/indra/llmath/llvolume.cpp @@ -96,93 +96,6 @@ extern BOOL gDebugGL; bool less_than_max_mag(const LLVector4a& vec); -template <class T, U32 alignment> -LLAlignedArray<T, alignment>::LLAlignedArray() -{ - mArray = NULL; - mElementCount = 0; - mCapacity = 0; -} - -template <class T, U32 alignment> -LLAlignedArray<T, alignment>::~LLAlignedArray() -{ - ll_aligned_free(mArray); - mArray = NULL; - mElementCount = 0; - mCapacity = 0; -} - -template <class T, U32 alignment> -void LLAlignedArray<T, alignment>::push_back(const T& elem) -{ - T* old_buf = NULL; - if (mCapacity <= mElementCount) - { - mCapacity++; - mCapacity *= 2; - T* new_buf = (T*) ll_aligned_malloc(mCapacity*sizeof(T), alignment); - if (mArray) - { - LLVector4a::memcpyNonAliased16((F32*) new_buf, (F32*) mArray, sizeof(T)*mElementCount); - } - old_buf = mArray; - mArray = new_buf; - } - - mArray[mElementCount++] = elem; - - //delete old array here to prevent error on a.push_back(a[0]) - ll_aligned_free(old_buf); -} - -template <class T, U32 alignment> -void LLAlignedArray<T, alignment>::resize(U32 size) -{ - if (mCapacity < size) - { - mCapacity = size+mCapacity*2; - T* new_buf = mCapacity > 0 ? (T*) ll_aligned_malloc(mCapacity*sizeof(T), alignment) : NULL; - if (mArray) - { - LLVector4a::memcpyNonAliased16((F32*) new_buf, (F32*) mArray, sizeof(T)*mElementCount); - ll_aligned_free(mArray); - } - - /*for (U32 i = mElementCount; i < mCapacity; ++i) - { - new(new_buf+i) T(); - }*/ - mArray = new_buf; - } - - mElementCount = size; -} - - -template <class T, U32 alignment> -T& LLAlignedArray<T, alignment>::operator[](int idx) -{ - llassert(idx < mElementCount); - return mArray[idx]; -} - -template <class T, U32 alignment> -const T& LLAlignedArray<T, alignment>::operator[](int idx) const -{ - llassert(idx < mElementCount); - return mArray[idx]; -} - -template <class T, U32 alignment> -T* LLAlignedArray<T, alignment>::append(S32 N) -{ - U32 sz = size(); - resize(sz+N); - return &((*this)[sz]); -} - - BOOL check_same_clock_dir( const LLVector3& pt1, const LLVector3& pt2, const LLVector3& pt3, const LLVector3& norm) { LLVector3 test = (pt2-pt1)%(pt3-pt2); |