diff --git a/indra/llmath/llmatrix4a.h b/indra/llmath/llmatrix4a.h index df94d7327e68b2b1fe9b4682704694d723acaf83..7be4e5a066ae9c524753b39bfcd8353f67627ee7 100644 --- a/indra/llmath/llmatrix4a.h +++ b/indra/llmath/llmatrix4a.h @@ -32,10 +32,10 @@ #include "m4math.h" #include "m3math.h" -class alignas(16) LLMatrix4a +LL_ALIGN_PREFIX(16) class LLMatrix4a { public: - LLVector4a mMatrix[4]; + LL_ALIGN_PREFIX(16) LLVector4a mMatrix[4] LL_ALIGN_POSTFIX(16); public: enum { @@ -45,6 +45,26 @@ class alignas(16) LLMatrix4a ROW_TRANS }; + void* operator new(size_t size) + { + return ll_aligned_malloc_16(size); + } + + void* operator new[](size_t size) + { + return ll_aligned_malloc_16(size); + } + + void operator delete(void* ptr) + { + ll_aligned_free_16(ptr); + } + + void operator delete[](void* ptr) + { + ll_aligned_free_16(ptr); + } + LLMatrix4a() = default; LLMatrix4a(const LLQuad& q1,const LLQuad& q2,const LLQuad& q3,const LLQuad& q4) { @@ -767,7 +787,7 @@ class alignas(16) LLMatrix4a return _mm_movemask_epi8(_mm_castps_si128(_mm_and_ps(mask1, mask2))) == 0xFFFF; } -}; +} LL_ALIGN_POSTFIX(16); #ifndef SHOW_ASSERT static_assert(std::is_trivial<LLMatrix4a>::value, "LLMatrix4a must be a trivial type"); diff --git a/indra/llmath/llsimdtypes.h b/indra/llmath/llsimdtypes.h index ce1e24dc681d5fc328d3bc5a5f42c66b4e887974..715c3563480b05ad4fa834f7e410b41351040649 100644 --- a/indra/llmath/llsimdtypes.h +++ b/indra/llmath/llsimdtypes.h @@ -66,11 +66,6 @@ class LLSimdScalar mQ = _mm_set_ss(f); } - static inline LLSimdScalar getZero() - { - return _mm_setzero_ps(); - } - inline F32 getF32() const; inline LLBool32 isApproximatelyEqual(const LLSimdScalar& rhs, F32 tolerance = F_APPROXIMATELY_ZERO) const; diff --git a/indra/llmath/llvector4a.h b/indra/llmath/llvector4a.h index 0e564889a5e9ad0828a1f4f2dec7bd58730750cc..aa75c5f076c2947ad81aeb76a78c86d67d8dc0ce 100644 --- a/indra/llmath/llvector4a.h +++ b/indra/llmath/llvector4a.h @@ -94,6 +94,26 @@ struct alignas(16) LLVector4a static void memcpyNonAliased16(F32* __restrict dst, const F32* __restrict src, size_t bytes); + void* operator new(size_t size) + { + return ll_aligned_malloc_16(size); + } + + void* operator new[](size_t size) + { + return ll_aligned_malloc_16(size); + } + + void operator delete(void* ptr) + { + ll_aligned_free_16(ptr); + } + + void operator delete[](void* ptr) + { + ll_aligned_free_16(ptr); + } + //////////////////////////////////// // CONSTRUCTORS //////////////////////////////////// @@ -380,7 +400,8 @@ inline std::ostream& operator<<(std::ostream& s, const LLVector4a& v) return s; } -struct alignas(16) LLIVector4a +LL_ALIGN_PREFIX(16) +struct LLIVector4a { friend struct LLVector4a; @@ -391,6 +412,26 @@ struct alignas(16) LLIVector4a return _mm_setzero_si128(); } + void* operator new(size_t size) + { + return ll_aligned_malloc_16(size); + } + + void* operator new[](size_t size) + { + return ll_aligned_malloc_16(size); + } + + void operator delete(void* ptr) + { + ll_aligned_free_16(ptr); + } + + void operator delete[](void* ptr) + { + ll_aligned_free_16(ptr); + } + //////////////////////////////////// // CONSTRUCTORS //////////////////////////////////// @@ -498,7 +539,7 @@ struct alignas(16) LLIVector4a } LLIQuad mQ; -}; +} LL_ALIGN_POSTFIX(16); static_assert(std::is_trivial<LLIVector4a>{}, "LLIVector4a must be a trivial type"); static_assert(std::is_standard_layout<LLIVector4a>{}, "LLIVector4a must be a standard layout type");