diff options
| -rw-r--r-- | indra/llmath/llbbox.h | 4 | ||||
| -rw-r--r-- | indra/llmath/llbboxlocal.h | 3 | ||||
| -rw-r--r-- | indra/llmath/llcoordframe.cpp | 1 | ||||
| -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/llsimdtypes.h | 12 | ||||
| -rw-r--r-- | indra/llmath/llvector4a.cpp | 2 | ||||
| -rw-r--r-- | indra/llmath/llvector4a.h | 11 | ||||
| -rw-r--r-- | indra/llmath/llvector4a.inl | 6 | ||||
| -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/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 | 3 | ||||
| -rw-r--r-- | indra/llmath/v4coloru.h | 3 | ||||
| -rw-r--r-- | indra/llmath/v4math.h | 4 |
25 files changed, 84 insertions, 40 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/llcoordframe.cpp b/indra/llmath/llcoordframe.cpp index 4d6276b2cd..15c9f6ff3f 100644 --- a/indra/llmath/llcoordframe.cpp +++ b/indra/llmath/llcoordframe.cpp @@ -26,7 +26,6 @@ #include "linden_common.h" -//#include "vmath.h" #include "v3math.h" #include "m3math.h" #include "v4math.h" diff --git a/indra/llmath/llline.h b/indra/llmath/llline.h index 33c1eb61a4..2c66f2267d 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/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.cpp b/indra/llmath/llvector4a.cpp index 0ac91366b6..b81d50f0f9 100644 --- a/indra/llmath/llvector4a.cpp +++ b/indra/llmath/llvector4a.cpp @@ -24,6 +24,8 @@ * $/LicenseInfo$ */ +#include "linden_common.h" + #include "llmemory.h" #include "llmath.h" #include "llquantize.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 36dbec078c..77a0257fbf 100644 --- a/indra/llmath/llvector4a.inl +++ b/indra/llmath/llvector4a.inl @@ -593,12 +593,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 c46ee587cb..2a6e52798b 100644 --- a/indra/llmath/m4math.cpp +++ b/indra/llmath/m4math.cpp @@ -157,10 +157,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/v2math.h b/indra/llmath/v2math.h index a61c946304..c84c441492 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 f7af469e66..139db9539f 100644 --- a/indra/llmath/v3color.h +++ b/indra/llmath/v3color.h @@ -151,8 +151,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() { diff --git a/indra/llmath/v3dmath.h b/indra/llmath/v3dmath.h index ece8c54ea4..d261e9de88 100644 --- a/indra/llmath/v3dmath.h +++ b/indra/llmath/v3dmath.h @@ -130,6 +130,10 @@ class LLVector3d }; +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 a3bfa68060..8f0d00270d 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 cafdbd9d7c..97ffead7a0 100644 --- a/indra/llmath/v4color.h +++ b/indra/llmath/v4color.h @@ -232,6 +232,9 @@ class LLColor4 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 diff --git a/indra/llmath/v4coloru.h b/indra/llmath/v4coloru.h index 29128a08a7..e17db7704a 100644 --- a/indra/llmath/v4coloru.h +++ b/indra/llmath/v4coloru.h @@ -134,6 +134,9 @@ 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 diff --git a/indra/llmath/v4math.h b/indra/llmath/v4math.h index a4c9668fdd..f5b79759b0 100644 --- a/indra/llmath/v4math.h +++ b/indra/llmath/v4math.h @@ -146,6 +146,10 @@ class LLVector4 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 |
