diff options
Diffstat (limited to 'indra/llmath')
| -rw-r--r-- | indra/llmath/llbbox.h | 4 | ||||
| -rw-r--r-- | indra/llmath/llbboxlocal.h | 3 | ||||
| -rw-r--r-- | indra/llmath/llline.h | 5 | ||||
| -rw-r--r-- | indra/llmath/llmatrix3a.h | 8 | ||||
| -rw-r--r-- | indra/llmath/llmatrix4a.h | 7 | ||||
| -rw-r--r-- | indra/llmath/llplane.h | 3 | ||||
| -rw-r--r-- | indra/llmath/llquaternion.h | 4 | ||||
| -rw-r--r-- | indra/llmath/llquaternion2.h | 4 | ||||
| -rw-r--r-- | indra/llmath/llrect.h | 8 | ||||
| -rw-r--r-- | indra/llmath/llsimdmath.h | 8 | ||||
| -rw-r--r-- | indra/llmath/llsimdtypes.h | 12 | ||||
| -rw-r--r-- | indra/llmath/llvector4a.h | 11 | ||||
| -rw-r--r-- | indra/llmath/llvector4a.inl | 24 | ||||
| -rw-r--r-- | indra/llmath/llvector4logical.h | 6 | ||||
| -rw-r--r-- | indra/llmath/m3math.h | 4 | ||||
| -rw-r--r-- | indra/llmath/m4math.cpp | 4 | ||||
| -rw-r--r-- | indra/llmath/m4math.h | 6 | ||||
| -rw-r--r-- | indra/llmath/tests/llquaternion_test.cpp | 6 | ||||
| -rw-r--r-- | indra/llmath/v2math.h | 3 | ||||
| -rw-r--r-- | indra/llmath/v3color.h | 5 | ||||
| -rw-r--r-- | indra/llmath/v3dmath.h | 4 | ||||
| -rw-r--r-- | indra/llmath/v3math.h | 4 | ||||
| -rw-r--r-- | indra/llmath/v4color.h | 4 | ||||
| -rw-r--r-- | indra/llmath/v4coloru.h | 4 | ||||
| -rw-r--r-- | indra/llmath/v4math.h | 4 |
25 files changed, 110 insertions, 45 deletions
diff --git a/indra/llmath/llbbox.h b/indra/llmath/llbbox.h index 5617eaebde..3a4e09a598 100644 --- a/indra/llmath/llbbox.h +++ b/indra/llmath/llbbox.h @@ -95,6 +95,10 @@ private: bool mEmpty; // Nothing has been added to this bbox yet }; +static_assert(std::is_trivially_copyable<LLBBox>::value, "LLBBox must be trivial copy"); +static_assert(std::is_trivially_move_assignable<LLBBox>::value, "LLBBox must be trivial move"); +static_assert(std::is_standard_layout<LLBBox>::value, "LLBBox must be a standard layout type"); + //LLBBox operator*(const LLBBox &a, const LLMatrix4 &b); diff --git a/indra/llmath/llbboxlocal.h b/indra/llmath/llbboxlocal.h index e215e55460..f743bc0ee4 100644 --- a/indra/llmath/llbboxlocal.h +++ b/indra/llmath/llbboxlocal.h @@ -61,5 +61,8 @@ private: LLBBoxLocal operator*(const LLBBoxLocal &a, const LLMatrix4 &b); +static_assert(std::is_trivially_copyable<LLBBoxLocal>::value, "LLBBoxLocal must be trivial copy"); +static_assert(std::is_trivially_move_assignable<LLBBoxLocal>::value, "LLBBoxLocal must be trivial move"); +static_assert(std::is_standard_layout<LLBBoxLocal>::value, "LLBBoxLocal must be a standard layout type"); #endif // LL_BBOXLOCAL_H diff --git a/indra/llmath/llline.h b/indra/llmath/llline.h index e98e173d1f..fa151f8b20 100644 --- a/indra/llmath/llline.h +++ b/indra/llmath/llline.h @@ -40,7 +40,7 @@ class LLLine public: LLLine(); LLLine( const LLVector3& first_point, const LLVector3& second_point ); - virtual ~LLLine() {}; + ~LLLine() = default; void setPointDirection( const LLVector3& first_point, const LLVector3& second_point ); void setPoints( const LLVector3& first_point, const LLVector3& second_point ); @@ -76,5 +76,8 @@ protected: LLVector3 mDirection; }; +static_assert(std::is_trivially_copyable<LLLine>::value, "LLLine must be trivial copy"); +static_assert(std::is_trivially_move_assignable<LLLine>::value, "LLLine must be trivial move"); +static_assert(std::is_standard_layout<LLLine>::value, "LLLine must be a standard layout type"); #endif diff --git a/indra/llmath/llmatrix3a.h b/indra/llmath/llmatrix3a.h index dff6604ae5..9b173c22ed 100644 --- a/indra/llmath/llmatrix3a.h +++ b/indra/llmath/llmatrix3a.h @@ -56,7 +56,7 @@ public: ////////////////////////// // Ctor - LLMatrix3a() {} + LLMatrix3a() = default; // Ctor for setting by columns inline LLMatrix3a( const LLVector4a& c0, const LLVector4a& c1, const LLVector4a& c2 ); @@ -115,14 +115,18 @@ protected: }; +static_assert(std::is_trivial<LLMatrix3a>::value, "LLMatrix3a must be a trivial type"); + class LLRotation : public LLMatrix3a { public: - LLRotation() {} + LLRotation() = default; // Returns true if this rotation is orthonormal with det ~= 1 inline bool isOkRotation() const; }; +static_assert(std::is_trivial<LLRotation>::value, "LLRotation must be a trivial type"); + #endif diff --git a/indra/llmath/llmatrix4a.h b/indra/llmath/llmatrix4a.h index 3b423f783a..377203098e 100644 --- a/indra/llmath/llmatrix4a.h +++ b/indra/llmath/llmatrix4a.h @@ -36,10 +36,7 @@ class LLMatrix4a public: LL_ALIGN_16(LLVector4a mMatrix[4]); - LLMatrix4a() - { - - } + LLMatrix4a() = default; explicit LLMatrix4a(const LLMatrix4& val) { @@ -228,6 +225,8 @@ public: const LLVector4a& getTranslation() const { return mMatrix[3]; } }; +static_assert(std::is_trivial<LLMatrix4a>::value, "LLMatrix4a must be a trivial type"); + inline LLVector4a rowMul(const LLVector4a &row, const LLMatrix4a &mat) { LLVector4a result; diff --git a/indra/llmath/llplane.h b/indra/llmath/llplane.h index 4e8546e32b..832004bb64 100644 --- a/indra/llmath/llplane.h +++ b/indra/llmath/llplane.h @@ -43,7 +43,7 @@ class LLPlane public: // Constructors - LLPlane() {}; // no default constructor + LLPlane() = default; LLPlane(const LLVector3 &p0, F32 d) { setVec(p0, d); } LLPlane(const LLVector3 &p0, const LLVector3 &n) { setVec(p0, n); } inline void setVec(const LLVector3 &p0, F32 d) { mV.set(p0[0], p0[1], p0[2], d); } @@ -104,6 +104,7 @@ private: LLVector4a mV; } LL_ALIGN_POSTFIX(16); +static_assert(std::is_trivial<LLPlane>::value, "LLPlane must be a trivial type"); #endif // LL_LLPLANE_H diff --git a/indra/llmath/llquaternion.h b/indra/llmath/llquaternion.h index 762d13eded..472d7ca62d 100644 --- a/indra/llmath/llquaternion.h +++ b/indra/llmath/llquaternion.h @@ -174,6 +174,10 @@ public: //static U32 mMultCount; }; +static_assert(std::is_trivially_copyable<LLQuaternion>::value, "LLQuaternion must be trivial copy"); +static_assert(std::is_trivially_move_assignable<LLQuaternion>::value, "LLQuaternion must be trivial move"); +static_assert(std::is_standard_layout<LLQuaternion>::value, "LLQuaternion must be a standard layout type"); + inline LLSD LLQuaternion::getValue() const { LLSD ret; diff --git a/indra/llmath/llquaternion2.h b/indra/llmath/llquaternion2.h index 902bfb7134..c9dcc4573f 100644 --- a/indra/llmath/llquaternion2.h +++ b/indra/llmath/llquaternion2.h @@ -49,7 +49,7 @@ public: ////////////////////////// // Ctor - LLQuaternion2() {} + LLQuaternion2() = default; // Ctor from LLQuaternion explicit LLQuaternion2( const class LLQuaternion& quat ); @@ -102,4 +102,6 @@ protected: }; +static_assert(std::is_trivial<LLQuaternion2>::value, "LLQuaternion2 must be a trivial type"); + #endif diff --git a/indra/llmath/llrect.h b/indra/llmath/llrect.h index 317578da06..0a3da2fee0 100644 --- a/indra/llmath/llrect.h +++ b/indra/llmath/llrect.h @@ -51,10 +51,6 @@ public: LLRectBase(): mLeft(0), mTop(0), mRight(0), mBottom(0) {} - LLRectBase(const LLRectBase &r): - mLeft(r.mLeft), mTop(r.mTop), mRight(r.mRight), mBottom(r.mBottom) - {} - LLRectBase(Type left, Type top, Type right, Type bottom): mLeft(left), mTop(top), mRight(right), mBottom(bottom) {} @@ -295,4 +291,8 @@ template <class Type> LLRectBase<Type> LLRectBase<Type>::null(0,0,0,0); typedef LLRectBase<S32> LLRect; typedef LLRectBase<F32> LLRectf; +static_assert(std::is_trivially_copyable<LLRect>::value, "LLRect must be trivial copy"); +static_assert(std::is_trivially_move_assignable<LLRect>::value, "LLRect must be trivial move"); +static_assert(std::is_standard_layout<LLRect>::value, "LLRect must be a standard layout type"); + #endif diff --git a/indra/llmath/llsimdmath.h b/indra/llmath/llsimdmath.h index 6242095456..440561e589 100644 --- a/indra/llmath/llsimdmath.h +++ b/indra/llmath/llsimdmath.h @@ -31,8 +31,12 @@ #error "Please include llmath.h before this file." #endif -#if ( ( LL_DARWIN || LL_LINUX ) && !(__SSE2__ || __ARM_NEON) ) || ( LL_WINDOWS && ( _M_IX86_FP < 2 && ADDRESS_SIZE == 32 ) ) -#error SSE2 not enabled. LLVector4a and related class will not compile. +#if ( ( LL_DARWIN || LL_LINUX ) ) + #if !(__SSE2__ || __ARM_NEON) + #error SSE2 not enabled. LLVector4a and related class will not compile. + #endif +#elif ( LL_WINDOWS && ( _M_IX86_FP < 2 && ADDRESS_SIZE == 32 ) ) + #error SSE2 not enabled. LLVector4a and related class will not compile. #endif #if !LL_WINDOWS diff --git a/indra/llmath/llsimdtypes.h b/indra/llmath/llsimdtypes.h index a407f51029..6c4f55b0c0 100644 --- a/indra/llmath/llsimdtypes.h +++ b/indra/llmath/llsimdtypes.h @@ -36,7 +36,7 @@ typedef __m128 LLQuad; class LLBool32 { public: - inline LLBool32() {} + inline LLBool32() = default; inline LLBool32(int rhs) : m_bool(rhs) {} inline LLBool32(unsigned int rhs) : m_bool(rhs) {} inline LLBool32(bool rhs) { m_bool = static_cast<const int>(rhs); } @@ -46,13 +46,15 @@ public: inline operator bool() const { return static_cast<const bool&>(m_bool); } private: - int m_bool{ 0 }; + int m_bool; }; +static_assert(std::is_trivial<LLBool32>::value, "LLBool32 must be a standard layout type"); + class LLSimdScalar { public: - inline LLSimdScalar() {} + inline LLSimdScalar() = default; inline LLSimdScalar(LLQuad q) { mQ = q; @@ -100,7 +102,9 @@ public: } private: - LLQuad mQ{}; + LLQuad mQ; }; +static_assert(std::is_trivial<LLSimdScalar>::value, "LLSimdScalar must be a standard layout type"); + #endif //LL_SIMD_TYPES_H diff --git a/indra/llmath/llvector4a.h b/indra/llmath/llvector4a.h index 4004852e06..764a3b94e6 100644 --- a/indra/llmath/llvector4a.h +++ b/indra/llmath/llvector4a.h @@ -95,10 +95,7 @@ public: //////////////////////////////////// //LLVector4a is plain data which should never have a default constructor or destructor(malloc&free won't trigger it) - LLVector4a() - { //DO NOT INITIALIZE -- The overhead is completely unnecessary - ll_assert_aligned(this,16); - } + LLVector4a() = default; LLVector4a(F32 x, F32 y, F32 z, F32 w = 0.f) { @@ -361,8 +358,6 @@ public: //////////////////////////////////// // Do NOT add aditional operators without consulting someone with SSE experience - inline const LLVector4a& operator= ( const LLVector4a& rhs ); - inline const LLVector4a& operator= ( const LLQuad& rhs ); inline operator LLQuad() const; @@ -378,9 +373,11 @@ public: }; private: - LLQuad mQ{}; + LLQuad mQ; }; +static_assert(std::is_trivial<LLVector4a>::value, "LLVector4a must be a trivial type"); + inline void update_min_max(LLVector4a& min, LLVector4a& max, const LLVector4a& p) { min.setMin(min, p); diff --git a/indra/llmath/llvector4a.inl b/indra/llmath/llvector4a.inl index 17e7de6eeb..0f7c4123ac 100644 --- a/indra/llmath/llvector4a.inl +++ b/indra/llmath/llvector4a.inl @@ -115,7 +115,7 @@ inline void LLVector4a::set(F32 x, F32 y, F32 z, F32 w) // Set to all zeros inline void LLVector4a::clear() { - mQ = LLVector4a::getZero().mQ; + mQ = _mm_setzero_ps(); } inline void LLVector4a::splat(const F32 x) @@ -272,6 +272,9 @@ inline void LLVector4a::setCross3(const LLVector4a& a, const LLVector4a& b) // Set all elements to the dot product of the x, y, and z elements in a and b inline void LLVector4a::setAllDot3(const LLVector4a& a, const LLVector4a& b) { +#if (defined(__arm64__) || defined(__aarch64__)) + mQ = _mm_dp_ps(a.mQ, b.mQ, 0x7f); +#else // ab = { a[W]*b[W], a[Z]*b[Z], a[Y]*b[Y], a[X]*b[X] } const LLQuad ab = _mm_mul_ps( a.mQ, b.mQ ); // yzxw = { a[W]*b[W], a[Z]*b[Z], a[X]*b[X], a[Y]*b[Y] } @@ -284,11 +287,15 @@ inline void LLVector4a::setAllDot3(const LLVector4a& a, const LLVector4a& b) const __m128i zSplat = _mm_shuffle_epi32(_mm_castps_si128(ab), _MM_SHUFFLE( 2, 2, 2, 2 )); // mQ = { a[Z] * b[Z] + a[Y] * b[Y] + a[X] * b[X], same, same, same } mQ = _mm_add_ps(_mm_castsi128_ps(zSplat), xPlusYSplat); +#endif } // Set all elements to the dot product of the x, y, z, and w elements in a and b inline void LLVector4a::setAllDot4(const LLVector4a& a, const LLVector4a& b) { +#if (defined(__arm64__) || defined(__aarch64__)) + mQ = _mm_dp_ps(a.mQ, b.mQ, 0xff); +#else // ab = { a[W]*b[W], a[Z]*b[Z], a[Y]*b[Y], a[X]*b[X] } const LLQuad ab = _mm_mul_ps( a.mQ, b.mQ ); // yzxw = { a[W]*b[W], a[Z]*b[Z], a[X]*b[X], a[Y]*b[Y] } @@ -301,21 +308,29 @@ inline void LLVector4a::setAllDot4(const LLVector4a& a, const LLVector4a& b) // mQ = { a[W]*b[W] + a[Z] * b[Z] + a[Y] * b[Y] + a[X] * b[X], same, same, same } mQ = _mm_add_ps(xPlusYSplat, zPlusWSplat); +#endif } // Return the 3D dot product of this vector and b inline LLSimdScalar LLVector4a::dot3(const LLVector4a& b) const { +#if (defined(__arm64__) || defined(__aarch64__)) + return _mm_dp_ps(mQ, b.mQ, 0x7f); +#else const LLQuad ab = _mm_mul_ps( mQ, b.mQ ); const LLQuad splatY = _mm_castsi128_ps( _mm_shuffle_epi32( _mm_castps_si128(ab), _MM_SHUFFLE(1, 1, 1, 1) ) ); const LLQuad splatZ = _mm_castsi128_ps( _mm_shuffle_epi32( _mm_castps_si128(ab), _MM_SHUFFLE(2, 2, 2, 2) ) ); const LLQuad xPlusY = _mm_add_ps( ab, splatY ); return _mm_add_ps( xPlusY, splatZ ); +#endif } // Return the 4D dot product of this vector and b inline LLSimdScalar LLVector4a::dot4(const LLVector4a& b) const { +#if (defined(__arm64__) || defined(__aarch64__)) + return _mm_dp_ps(mQ, b.mQ, 0xff); +#else // ab = { w, z, y, x } const LLQuad ab = _mm_mul_ps( mQ, b.mQ ); // upperProdsInLowerElems = { y, x, y, x } @@ -325,6 +340,7 @@ inline LLSimdScalar LLVector4a::dot4(const LLVector4a& b) const // shuffled = { z+x, z+x, z+x, z+x } const LLQuad shuffled = _mm_castsi128_ps( _mm_shuffle_epi32( _mm_castps_si128( sumOfPairs ), _MM_SHUFFLE(1, 1, 1, 1) ) ); return _mm_add_ss( sumOfPairs, shuffled ); +#endif } // Normalize this vector with respect to the x, y, and z components only. Accurate to 22 bites of precision. W component is destroyed @@ -608,12 +624,6 @@ inline bool LLVector4a::equals3(const LLVector4a& rhs, F32 tolerance ) const //////////////////////////////////// // Do NOT add aditional operators without consulting someone with SSE experience -inline const LLVector4a& LLVector4a::operator= ( const LLVector4a& rhs ) -{ - mQ = rhs.mQ; - return *this; -} - inline const LLVector4a& LLVector4a::operator= ( const LLQuad& rhs ) { mQ = rhs; diff --git a/indra/llmath/llvector4logical.h b/indra/llmath/llvector4logical.h index 70759eef5c..77cb5862e5 100644 --- a/indra/llmath/llvector4logical.h +++ b/indra/llmath/llvector4logical.h @@ -61,7 +61,7 @@ public: }; // Empty default ctor - LLVector4Logical() {} + LLVector4Logical() = default; LLVector4Logical( const LLQuad& quad ) { @@ -120,7 +120,9 @@ public: private: - LLQuad mQ{}; + LLQuad mQ; }; +static_assert(std::is_trivial<LLVector4Logical>::value, "LLVector4Logical must be a standard layout type"); + #endif //LL_VECTOR4ALOGICAL_H diff --git a/indra/llmath/m3math.h b/indra/llmath/m3math.h index cd14290246..36661d2cb0 100644 --- a/indra/llmath/m3math.h +++ b/indra/llmath/m3math.h @@ -142,6 +142,10 @@ class LLMatrix3 friend std::ostream& operator<<(std::ostream& s, const LLMatrix3 &a); // Stream a }; +static_assert(std::is_trivially_copyable<LLMatrix3>::value, "LLMatrix3 must be trivial copy"); +static_assert(std::is_trivially_move_assignable<LLMatrix3>::value, "LLMatrix3 must be trivial move"); +static_assert(std::is_standard_layout<LLMatrix3>::value, "LLMatrix3 must be a standard layout type"); + inline LLMatrix3::LLMatrix3(void) { mMatrix[0][0] = 1.f; diff --git a/indra/llmath/m4math.cpp b/indra/llmath/m4math.cpp index a9853fe7e9..1724a50601 100644 --- a/indra/llmath/m4math.cpp +++ b/indra/llmath/m4math.cpp @@ -156,10 +156,6 @@ LLMatrix4::LLMatrix4(const F32 roll, const F32 pitch, const F32 yaw) mMatrix[3][3] = 1.f; } -LLMatrix4::~LLMatrix4(void) -{ -} - // Clear and Assignment Functions const LLMatrix4& LLMatrix4::setZero() diff --git a/indra/llmath/m4math.h b/indra/llmath/m4math.h index b0f8c90cdf..f164779283 100644 --- a/indra/llmath/m4math.h +++ b/indra/llmath/m4math.h @@ -119,8 +119,6 @@ public: const LLVector4 &pos); // Initializes Matrix with Euler angles LLMatrix4(const F32 roll, const F32 pitch, const F32 yaw); // Initializes Matrix with Euler angles - ~LLMatrix4(void); // Destructor - LLSD getValue() const; void setValue(const LLSD&); @@ -242,6 +240,10 @@ public: friend std::ostream& operator<<(std::ostream& s, const LLMatrix4 &a); // Stream a }; +static_assert(std::is_trivially_copyable<LLMatrix4>::value, "LLMatrix4 must be trivial copy"); +static_assert(std::is_trivially_move_assignable<LLMatrix4>::value, "LLMatrix4 must be trivial move"); +static_assert(std::is_standard_layout<LLMatrix4>::value, "LLMatrix4 must be a standard layout type"); + inline const LLMatrix4& LLMatrix4::setIdentity() { mMatrix[0][0] = 1.f; diff --git a/indra/llmath/tests/llquaternion_test.cpp b/indra/llmath/tests/llquaternion_test.cpp index aa3c0ad843..ba18d54d55 100644 --- a/indra/llmath/tests/llquaternion_test.cpp +++ b/indra/llmath/tests/llquaternion_test.cpp @@ -349,9 +349,9 @@ namespace tut ensure( "2. LLVector4 operator*(const LLVector4 &a, const LLQuaternion &rot) failed", is_approx_equal(-58153.5390f, result.mV[0]) && - (183787.8125f == result.mV[1]) && - (116864.164063f == result.mV[2]) && - (78.099998f == result.mV[3])); + is_approx_equal(183787.8125f, result.mV[1]) && + is_approx_equal(116864.164063f, result.mV[2]) && + is_approx_equal(78.099998f, result.mV[3])); } //test case for LLVector3 operator*(const LLVector3 &a, const LLQuaternion &rot) fn. diff --git a/indra/llmath/v2math.h b/indra/llmath/v2math.h index 6b9d37535b..b31e4056a3 100644 --- a/indra/llmath/v2math.h +++ b/indra/llmath/v2math.h @@ -110,6 +110,9 @@ class LLVector2 friend std::ostream& operator<<(std::ostream& s, const LLVector2 &a); // Stream a }; +static_assert(std::is_trivially_copyable<LLVector2>::value, "LLVector2 must be trivial copy"); +static_assert(std::is_trivially_move_assignable<LLVector2>::value, "LLVector2 must be trivial move"); +static_assert(std::is_standard_layout<LLVector2>::value, "LLVector2 must be a standard layout type"); // Non-member functions diff --git a/indra/llmath/v3color.h b/indra/llmath/v3color.h index 48b36e7c8a..7357d93599 100644 --- a/indra/llmath/v3color.h +++ b/indra/llmath/v3color.h @@ -144,8 +144,11 @@ public: inline void exp(); // Do an exponential on the color }; -LLColor3 lerp(const LLColor3& a, const LLColor3& b, F32 u); +static_assert(std::is_trivially_copyable<LLColor3>::value, "LLColor3 must be trivial copy"); +static_assert(std::is_trivially_move_assignable<LLColor3>::value, "LLColor3 must be trivial move"); +static_assert(std::is_standard_layout<LLColor3>::value, "LLColor3 must be a standard layout type"); +LLColor3 lerp(const LLColor3& a, const LLColor3& b, F32 u); void LLColor3::clamp() { // Clamp the color... diff --git a/indra/llmath/v3dmath.h b/indra/llmath/v3dmath.h index fcce2c30eb..7c56cf138d 100644 --- a/indra/llmath/v3dmath.h +++ b/indra/llmath/v3dmath.h @@ -129,6 +129,10 @@ public: static bool parseVector3d(const std::string& buf, LLVector3d* value); }; +static_assert(std::is_trivially_copyable<LLVector3d>::value, "LLVector3d must be trivial copy"); +static_assert(std::is_trivially_move_assignable<LLVector3d>::value, "LLVector3d must be trivial move"); +static_assert(std::is_standard_layout<LLVector3d>::value, "LLVector3d must be a standard layout type"); + typedef LLVector3d LLGlobalVec; inline const LLVector3d &LLVector3d::set(const LLVector3 &vec) diff --git a/indra/llmath/v3math.h b/indra/llmath/v3math.h index 098ca5218c..196ecdcf7d 100644 --- a/indra/llmath/v3math.h +++ b/indra/llmath/v3math.h @@ -164,6 +164,10 @@ class LLVector3 static bool parseVector3(const std::string& buf, LLVector3* value); }; +static_assert(std::is_trivially_copyable<LLVector3>::value, "LLVector3 must be trivial copy"); +static_assert(std::is_trivially_move_assignable<LLVector3>::value, "LLVector3 must be trivial move"); +static_assert(std::is_standard_layout<LLVector3>::value, "LLVector3 must be a standard layout type"); + typedef LLVector3 LLSimLocalVec; // Non-member functions diff --git a/indra/llmath/v4color.h b/indra/llmath/v4color.h index 2f1cb21113..d48020c223 100644 --- a/indra/llmath/v4color.h +++ b/indra/llmath/v4color.h @@ -231,6 +231,10 @@ public: inline void clamp(); }; +static_assert(std::is_trivially_copyable<LLColor4>::value, "LLColor4 must be trivial copy"); +static_assert(std::is_trivially_move_assignable<LLColor4>::value, "LLColor4 must be trivial move"); +static_assert(std::is_standard_layout<LLColor4>::value, "LLColor4 must be a standard layout type"); + // Non-member functions F32 distVec(const LLColor4& a, const LLColor4& b); // Returns distance between a and b F32 distVec_squared(const LLColor4& a, const LLColor4& b); // Returns distance squared between a and b diff --git a/indra/llmath/v4coloru.h b/indra/llmath/v4coloru.h index bfa998bc58..e495fd3eea 100644 --- a/indra/llmath/v4coloru.h +++ b/indra/llmath/v4coloru.h @@ -123,6 +123,10 @@ public: static LLColor4U blue; }; +static_assert(std::is_trivially_copyable<LLColor4U>::value, "LLColor4U must be trivial copy"); +static_assert(std::is_trivially_move_assignable<LLColor4U>::value, "LLColor4U must be trivial move"); +static_assert(std::is_standard_layout<LLColor4U>::value, "LLColor4U must be a standard layout type"); + // Non-member functions F32 distVec(const LLColor4U& a, const LLColor4U& b); // Returns distance between a and b F32 distVec_squared(const LLColor4U& a, const LLColor4U& b); // Returns distance squared between a and b diff --git a/indra/llmath/v4math.h b/indra/llmath/v4math.h index 1cbd0d9a78..edfc2f8592 100644 --- a/indra/llmath/v4math.h +++ b/indra/llmath/v4math.h @@ -146,6 +146,10 @@ public: friend LLVector4 operator-(const LLVector4 &a); // Return vector -a }; +static_assert(std::is_trivially_copyable<LLVector4>::value, "LLVector4 must be trivial copy"); +static_assert(std::is_trivially_move_assignable<LLVector4>::value, "LLVector4 must be trivial move"); +static_assert(std::is_standard_layout<LLVector4>::value, "LLVector4 must be a standard layout type"); + // Non-member functions F32 angle_between(const LLVector4 &a, const LLVector4 &b); // Returns angle (radians) between a and b bool are_parallel(const LLVector4 &a, const LLVector4 &b, F32 epsilon = F_APPROXIMATELY_ZERO); // Returns true if a and b are very close to parallel |
