diff --git a/indra/llcommon/lluuid.h b/indra/llcommon/lluuid.h
index fe4fb2676..66a845738 100644
--- a/indra/llcommon/lluuid.h
+++ b/indra/llcommon/lluuid.h
@@ -57,10 +57,10 @@ public:
LLUUID();
explicit LLUUID(const char *in_string); // Convert from string.
explicit LLUUID(const std::string& in_string); // Convert from string.
- LLUUID(const LLUUID &in);
- LLUUID &operator=(const LLUUID &rhs);
+ LLUUID(const LLUUID &in) = default;
+ LLUUID &operator=(const LLUUID &rhs) = default;
- ~LLUUID();
+ ~LLUUID() = default;
//
// MANIPULATORS
@@ -193,24 +193,6 @@ inline BOOL LLUUID::isNull() const
return !memcmp(mData, null.mData, sizeof(mData)); //
}
-// Copy constructor
-inline LLUUID::LLUUID(const LLUUID& rhs)
-{
- memcpy(mData, rhs.mData, sizeof(mData)); //
-}
-
-inline LLUUID::~LLUUID()
-{
-}
-
-// Assignment
-inline LLUUID& LLUUID::operator=(const LLUUID& rhs)
-{
- memcpy(mData, rhs.mData, sizeof(mData)); //
- return *this;
-}
-
-
inline LLUUID::LLUUID(const char *in_string)
{
if (!in_string || in_string[0] == 0)
@@ -289,6 +271,8 @@ inline U32 LLUUID::getCRC32() const
//
}
+static_assert(std::is_trivially_copyable{}, "LLUUID must be a trivially copyable type");
+
typedef std::vector uuid_vec_t;
typedef boost::unordered_set uuid_set_t;
diff --git a/indra/llmath/llmatrix3a.h b/indra/llmath/llmatrix3a.h
index 6d896613c..ea0c99237 100644
--- a/indra/llmath/llmatrix3a.h
+++ b/indra/llmath/llmatrix3a.h
@@ -127,4 +127,6 @@ public:
inline bool isOkRotation() const;
} LL_ALIGN_POSTFIX(16);
+static_assert(std::is_trivially_copyable{}, "LLMatrix3a must be a trivially copyable type");
+static_assert(std::is_trivially_copyable{}, "LLRotation must be a trivially copyable type");
#endif
diff --git a/indra/llmath/llmatrix4a.h b/indra/llmath/llmatrix4a.h
index 7dab479bd..7334eec52 100644
--- a/indra/llmath/llmatrix4a.h
+++ b/indra/llmath/llmatrix4a.h
@@ -708,4 +708,6 @@ inline std::ostream& operator<<(std::ostream& s, const LLMatrix4a& m)
}
void matMulBoundBox(const LLMatrix4a &a, const LLVector4a *in_extents, LLVector4a *out_extents);
+
+static_assert(std::is_trivially_copyable{}, "LLMatrix4a must be a trivially copyable type");
#endif
diff --git a/indra/llmath/llquaternion.h b/indra/llmath/llquaternion.h
index e7a279fb4..87b272008 100644
--- a/indra/llmath/llquaternion.h
+++ b/indra/llmath/llquaternion.h
@@ -191,6 +191,8 @@ inline void LLQuaternion::setValue(const LLSD& sd)
mQ[3] = sd[3].asReal();
}
+static_assert(std::is_trivially_copyable{}, "LLQuaternion must be a trivially copyable type");
+
// checker
inline BOOL LLQuaternion::isFinite() const
{
diff --git a/indra/llmath/llquaternion2.h b/indra/llmath/llquaternion2.h
index 6cfe91a02..b93d0471b 100644
--- a/indra/llmath/llquaternion2.h
+++ b/indra/llmath/llquaternion2.h
@@ -105,4 +105,6 @@ protected:
} LL_ALIGN_POSTFIX(16);
+static_assert(std::is_trivially_copyable{}, "LLQuaternion2 must be a trivially copyable type");
+
#endif
diff --git a/indra/llmath/llsimdtypes.h b/indra/llmath/llsimdtypes.h
index bd991d0e7..2861fa9b0 100644
--- a/indra/llmath/llsimdtypes.h
+++ b/indra/llmath/llsimdtypes.h
@@ -121,4 +121,7 @@ private:
LLQuad mQ;
};
+static_assert(std::is_trivially_copyable{}, "LLBool32 must be a trivially copyable type");
+static_assert(std::is_trivially_copyable{}, "LLSimdScalar must be a trivially copyable type");
+
#endif //LL_SIMD_TYPES_H
diff --git a/indra/llmath/llvector4a.h b/indra/llmath/llvector4a.h
index a34e3ec88..2b7cf10cb 100644
--- a/indra/llmath/llvector4a.h
+++ b/indra/llmath/llvector4a.h
@@ -96,12 +96,12 @@ public:
{ //DO NOT INITIALIZE -- The overhead is completely unnecessary
ll_assert_aligned(this,16);
}
-
+
LLVector4a(F32 x, F32 y, F32 z, F32 w = 0.f)
{
- set(x,y,z,w);
+ set(x, y, z, w);
}
-
+
LLVector4a(F32 x)
{
splat(x);
@@ -320,9 +320,13 @@ public:
////////////////////////////////////
// Do NOT add aditional operators without consulting someone with SSE experience
- inline const LLVector4a& operator= ( const LLVector4a& rhs );
+ //inline const LLVector4a& operator= ( const LLVector4a& rhs );
+ //{
+ // mQ = rhs.mQ;
+ // return *this;
+ //}
- inline const LLVector4a& operator= ( const LLQuad& rhs );
+ inline const LLVector4a& operator= (const LLQuad& rhs);
inline operator LLQuad() const;
@@ -341,4 +345,6 @@ inline std::ostream& operator<<(std::ostream& s, const LLVector4a& v)
s << "(" << v[0] << ", " << v[1] << ", " << v[2] << ", " << v[3] << ")";
return s;
}
+
+static_assert(std::is_trivially_copyable{}, "LLVector4a must be a trivially copyable type");
#endif
diff --git a/indra/llmath/llvector4a.inl b/indra/llmath/llvector4a.inl
index c3499d23d..40d67c86b 100644
--- a/indra/llmath/llvector4a.inl
+++ b/indra/llmath/llvector4a.inl
@@ -605,13 +605,7 @@ 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 )
+inline const LLVector4a& LLVector4a::operator= (const LLQuad& rhs)
{
mQ = rhs;
return *this;
diff --git a/indra/llmath/m3math.h b/indra/llmath/m3math.h
index 1bf42fefa..5822ff044 100644
--- a/indra/llmath/m3math.h
+++ b/indra/llmath/m3math.h
@@ -144,6 +144,8 @@ class LLMatrix3
friend std::ostream& operator<<(std::ostream& s, const LLMatrix3 &a); // Stream a
};
+static_assert(std::is_trivially_copyable{}, "LLMatrix3 must be a trivially copyable type");
+
inline LLMatrix3::LLMatrix3(void)
{
mMatrix[0][0] = 1.f;
diff --git a/indra/llmath/m4math.cpp b/indra/llmath/m4math.cpp
index 09253c75b..a225c51b1 100644
--- a/indra/llmath/m4math.cpp
+++ b/indra/llmath/m4math.cpp
@@ -152,10 +152,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 bf031678c..01739218b 100644
--- a/indra/llmath/m4math.h
+++ b/indra/llmath/m4math.h
@@ -117,7 +117,7 @@ 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
+ ~LLMatrix4() = default; // Destructor
LLSD getValue() const;
void setValue(const LLSD&);
@@ -246,6 +246,8 @@ public:
friend std::ostream& operator<<(std::ostream& s, const LLMatrix4 &a); // Stream a
};
+static_assert(std::is_trivially_copyable{}, "LLMatrix4 must be a trivially copyable type");
+
inline const LLMatrix4& LLMatrix4::setIdentity()
{
mMatrix[0][0] = 1.f;
diff --git a/indra/llmath/v2math.h b/indra/llmath/v2math.h
index b738fe70c..cc00096cc 100644
--- a/indra/llmath/v2math.h
+++ b/indra/llmath/v2math.h
@@ -110,6 +110,7 @@ class LLVector2
friend std::ostream& operator<<(std::ostream& s, const LLVector2 &a); // Stream a
};
+static_assert(std::is_trivially_copyable{}, "LLVector2 must be a trivially copyable type");
// Non-member functions
diff --git a/indra/llmath/v3color.h b/indra/llmath/v3color.h
index 1a5cbeb51..d9a7f6286 100644
--- a/indra/llmath/v3color.h
+++ b/indra/llmath/v3color.h
@@ -140,6 +140,8 @@ public:
inline void exp(); // Do an exponential on the color
};
+static_assert(std::is_trivially_copyable{}, "LLColor3 must be a trivially copyable type");
+
LLColor3 lerp(const LLColor3 &a, const LLColor3 &b, F32 u);
diff --git a/indra/llmath/v3dmath.h b/indra/llmath/v3dmath.h
index dae0b3077..eed1ed061 100644
--- a/indra/llmath/v3dmath.h
+++ b/indra/llmath/v3dmath.h
@@ -130,6 +130,8 @@ class LLVector3d
};
+static_assert(std::is_trivially_copyable{}, "LLVector3d must be a trivially copyable 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 71ca661dd..65122b894 100644
--- a/indra/llmath/v3math.h
+++ b/indra/llmath/v3math.h
@@ -149,6 +149,8 @@ class LLVector3
static BOOL parseVector3(const std::string& buf, LLVector3* value);
};
+static_assert(std::is_trivially_copyable{}, "LLVector3 must be a trivially copyable type");
+
typedef LLVector3 LLSimLocalVec;
// Non-member functions
diff --git a/indra/llmath/v4color.h b/indra/llmath/v4color.h
index 2297a6616..e23d51075 100644
--- a/indra/llmath/v4color.h
+++ b/indra/llmath/v4color.h
@@ -222,6 +222,7 @@ class LLColor4
inline void clamp();
};
+static_assert(std::is_trivially_copyable{}, "LLColor4 must be a trivially copyable 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 36d8db45f..7eb9a2929 100644
--- a/indra/llmath/v4coloru.h
+++ b/indra/llmath/v4coloru.h
@@ -139,6 +139,7 @@ public:
static LLColor4U blue;
};
+static_assert(std::is_trivially_copyable{}, "LLColor4U must be a trivially copyable 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 a179ced70..5cfed4dc7 100644
--- a/indra/llmath/v4math.h
+++ b/indra/llmath/v4math.h
@@ -137,6 +137,8 @@ class LLVector4
friend LLVector4 operator-(const LLVector4 &a); // Return vector -a
};
+static_assert(std::is_trivially_copyable{}, "LLVector4 must be a trivially copyable 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
diff --git a/indra/llprimitive/llmaterialid.cpp b/indra/llprimitive/llmaterialid.cpp
index 820f62c43..fc72961ea 100644
--- a/indra/llprimitive/llmaterialid.cpp
+++ b/indra/llprimitive/llmaterialid.cpp
@@ -56,15 +56,6 @@ LLMaterialID::LLMaterialID(const void* pMemory)
set(pMemory);
}
-LLMaterialID::LLMaterialID(const LLMaterialID& pOtherMaterialID)
-{
- copyFromOtherMaterialID(pOtherMaterialID);
-}
-
-LLMaterialID::~LLMaterialID()
-{
-}
-
bool LLMaterialID::operator == (const LLMaterialID& pOtherMaterialID) const
{
return (compareToOtherMaterialID(pOtherMaterialID) == 0);
@@ -95,12 +86,6 @@ bool LLMaterialID::operator >= (const LLMaterialID& pOtherMaterialID) const
return (compareToOtherMaterialID(pOtherMaterialID) >= 0);
}
-LLMaterialID& LLMaterialID::operator = (const LLMaterialID& pOtherMaterialID)
-{
- copyFromOtherMaterialID(pOtherMaterialID);
- return (*this);
-}
-
bool LLMaterialID::isNull() const
{
return (compareToOtherMaterialID(LLMaterialID::null) == 0);
@@ -116,12 +101,12 @@ void LLMaterialID::set(const void* pMemory)
llassert(pMemory != NULL);
// assumes that the required size of memory is available
- memcpy(mID, pMemory, MATERIAL_ID_SIZE * sizeof(U8));
+ memcpy(mID, pMemory, sizeof(mID));
}
void LLMaterialID::clear()
{
- memset(mID, 0, MATERIAL_ID_SIZE * sizeof(U8));
+ memset(mID, 0, sizeof(mID));
}
LLSD LLMaterialID::asLLSD() const
@@ -156,18 +141,12 @@ std::ostream& operator<<(std::ostream& s, const LLMaterialID &material_id)
return s;
}
-
void LLMaterialID::parseFromBinary (const LLSD::Binary& pMaterialID)
{
llassert(pMaterialID.size() == (MATERIAL_ID_SIZE * sizeof(U8)));
memcpy(mID, &pMaterialID[0], MATERIAL_ID_SIZE * sizeof(U8));
}
-void LLMaterialID::copyFromOtherMaterialID(const LLMaterialID& pOtherMaterialID)
-{
- memcpy(mID, pOtherMaterialID.get(), MATERIAL_ID_SIZE * sizeof(U8));
-}
-
int LLMaterialID::compareToOtherMaterialID(const LLMaterialID& pOtherMaterialID) const
{
int retVal = 0;
diff --git a/indra/llprimitive/llmaterialid.h b/indra/llprimitive/llmaterialid.h
index b4c82d3b7..8036db2d9 100644
--- a/indra/llprimitive/llmaterialid.h
+++ b/indra/llprimitive/llmaterialid.h
@@ -39,8 +39,8 @@ public:
LLMaterialID(const LLSD& pMaterialID);
LLMaterialID(const LLSD::Binary& pMaterialID);
LLMaterialID(const void* pMemory);
- LLMaterialID(const LLMaterialID& pOtherMaterialID);
- ~LLMaterialID();
+ LLMaterialID(const LLMaterialID& pOtherMaterialID) = default;
+ ~LLMaterialID() = default;
bool operator == (const LLMaterialID& pOtherMaterialID) const;
bool operator != (const LLMaterialID& pOtherMaterialID) const;
@@ -50,7 +50,7 @@ public:
bool operator > (const LLMaterialID& pOtherMaterialID) const;
bool operator >= (const LLMaterialID& pOtherMaterialID) const;
- LLMaterialID& operator = (const LLMaterialID& pOtherMaterialID);
+ LLMaterialID& operator = (const LLMaterialID& pOtherMaterialID) = default;
bool isNull() const;
@@ -67,11 +67,13 @@ public:
private:
void parseFromBinary(const LLSD::Binary& pMaterialID);
- void copyFromOtherMaterialID(const LLMaterialID& pOtherMaterialID);
int compareToOtherMaterialID(const LLMaterialID& pOtherMaterialID) const;
U8 mID[MATERIAL_ID_SIZE];
} ;
+static_assert(sizeof(LLMaterialID) == MATERIAL_ID_SIZE, "LLMaterialID must be sizeof(mID)");
+static_assert(std::is_trivially_copyable{}, "LLMaterialID must be a trivially copyable type");
+
#endif // LL_LLMATERIALID_H