Skip to content

Commit b6a4296

Browse files
author
Rye
committed
Restore various llmath types to trivially copyable/movable and restore SIMD types to trivial
1 parent 4e5071e commit b6a4296

26 files changed

+87
-61
lines changed

indra/llmath/llbbox.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,10 @@ class LLBBox
9595
bool mEmpty; // Nothing has been added to this bbox yet
9696
};
9797

98+
static_assert(std::is_trivially_copyable<LLBBox>::value, "LLBBox must be trivial copy");
99+
static_assert(std::is_trivially_move_assignable<LLBBox>::value, "LLBBox must be trivial move");
100+
static_assert(std::is_standard_layout<LLBBox>::value, "LLBBox must be a standard layout type");
101+
98102
//LLBBox operator*(const LLBBox &a, const LLMatrix4 &b);
99103

100104

indra/llmath/llbboxlocal.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class LLMatrix4;
3434
class LLBBoxLocal
3535
{
3636
public:
37-
LLBBoxLocal() {}
37+
LLBBoxLocal() = default;
3838
LLBBoxLocal( const LLVector3& min, const LLVector3& max ) : mMin( min ), mMax( max ) {}
3939
// Default copy constructor is OK.
4040

@@ -61,5 +61,8 @@ class LLBBoxLocal
6161

6262
LLBBoxLocal operator*(const LLBBoxLocal &a, const LLMatrix4 &b);
6363

64+
static_assert(std::is_trivially_copyable<LLBBoxLocal>::value, "LLBBoxLocal must be trivial copy");
65+
static_assert(std::is_trivially_move_assignable<LLBBoxLocal>::value, "LLBBoxLocal must be trivial move");
66+
static_assert(std::is_standard_layout<LLBBoxLocal>::value, "LLBBoxLocal must be a standard layout type");
6467

6568
#endif // LL_BBOXLOCAL_H

indra/llmath/llline.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ class LLLine
4040
public:
4141
LLLine();
4242
LLLine( const LLVector3& first_point, const LLVector3& second_point );
43-
virtual ~LLLine() {};
4443

4544
void setPointDirection( const LLVector3& first_point, const LLVector3& second_point );
4645
void setPoints( const LLVector3& first_point, const LLVector3& second_point );
@@ -76,5 +75,8 @@ class LLLine
7675
LLVector3 mDirection;
7776
};
7877

78+
static_assert(std::is_trivially_copyable<LLLine>::value, "LLLine must be trivial copy");
79+
static_assert(std::is_trivially_move_assignable<LLLine>::value, "LLLine must be trivial move");
80+
static_assert(std::is_standard_layout<LLLine>::value, "LLLine must be a standard layout type");
7981

8082
#endif

indra/llmath/llmatrix3a.h

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ class LLMatrix3a
5656
//////////////////////////
5757

5858
// Ctor
59-
LLMatrix3a() {}
59+
LLMatrix3a() = default;
6060

6161
// Ctor for setting by columns
6262
inline LLMatrix3a( const LLVector4a& c0, const LLVector4a& c1, const LLVector4a& c2 );
@@ -115,14 +115,19 @@ class LLMatrix3a
115115

116116
};
117117

118+
static_assert(std::is_trivial<LLMatrix3a>::value, "LLMatrix3a must be a trivial type");
119+
118120
class LLRotation : public LLMatrix3a
119121
{
120122
public:
121123

122-
LLRotation() {}
124+
LLRotation() = default;
123125

124126
// Returns true if this rotation is orthonormal with det ~= 1
125127
inline bool isOkRotation() const;
126128
};
127129

130+
static_assert(std::is_trivial<LLRotation>::value, "LLRotation must be a trivial type");
131+
132+
128133
#endif

indra/llmath/llmatrix4a.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,7 @@ class LLMatrix4a
3636
public:
3737
LL_ALIGN_16(LLVector4a mMatrix[4]);
3838

39-
LLMatrix4a()
40-
{
41-
42-
}
39+
LLMatrix4a() = default;
4340

4441
explicit LLMatrix4a(const LLMatrix4& val)
4542
{
@@ -228,6 +225,8 @@ class LLMatrix4a
228225
const LLVector4a& getTranslation() const { return mMatrix[3]; }
229226
};
230227

228+
static_assert(std::is_trivial<LLMatrix4a>::value, "LLMatrix4a must be a trivial type");
229+
231230
inline LLVector4a rowMul(const LLVector4a &row, const LLMatrix4a &mat)
232231
{
233232
LLVector4a result;

indra/llmath/llplane.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ class LLPlane
4343
public:
4444

4545
// Constructors
46-
LLPlane() {}; // no default constructor
46+
LLPlane() = default; // no default constructor
4747
LLPlane(const LLVector3 &p0, F32 d) { setVec(p0, d); }
4848
LLPlane(const LLVector3 &p0, const LLVector3 &n) { setVec(p0, n); }
4949
inline void setVec(const LLVector3 &p0, F32 d) { mV.set(p0[0], p0[1], p0[2], d); }
@@ -104,6 +104,7 @@ class LLPlane
104104
LLVector4a mV;
105105
} LL_ALIGN_POSTFIX(16);
106106

107+
static_assert(std::is_trivial<LLPlane>::value, "LLPlane must be a trivial type");
107108

108109

109110
#endif // LL_LLPLANE_H

indra/llmath/llquaternion.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,10 @@ class LLQuaternion
174174
//static U32 mMultCount;
175175
};
176176

177+
static_assert(std::is_trivially_copyable<LLQuaternion>::value, "LLQuaternion must be trivial copy");
178+
static_assert(std::is_trivially_move_assignable<LLQuaternion>::value, "LLQuaternion must be trivial move");
179+
static_assert(std::is_standard_layout<LLQuaternion>::value, "LLQuaternion must be a standard layout type");
180+
177181
inline LLSD LLQuaternion::getValue() const
178182
{
179183
LLSD ret;

indra/llmath/llquaternion2.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ class LLQuaternion2
4949
//////////////////////////
5050

5151
// Ctor
52-
LLQuaternion2() {}
52+
LLQuaternion2() = default;
5353

5454
// Ctor from LLQuaternion
5555
explicit LLQuaternion2( const class LLQuaternion& quat );
@@ -102,4 +102,6 @@ class LLQuaternion2
102102

103103
};
104104

105+
static_assert(std::is_trivial<LLQuaternion2>::value, "LLQuaternion2 must be a trivial type");
106+
105107
#endif

indra/llmath/llrect.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,6 @@ template <class Type> class LLRectBase
5151
LLRectBase(): mLeft(0), mTop(0), mRight(0), mBottom(0)
5252
{}
5353

54-
LLRectBase(const LLRectBase &r):
55-
mLeft(r.mLeft), mTop(r.mTop), mRight(r.mRight), mBottom(r.mBottom)
56-
{}
57-
5854
LLRectBase(Type left, Type top, Type right, Type bottom):
5955
mLeft(left), mTop(top), mRight(right), mBottom(bottom)
6056
{}
@@ -295,4 +291,8 @@ template <class Type> LLRectBase<Type> LLRectBase<Type>::null(0,0,0,0);
295291
typedef LLRectBase<S32> LLRect;
296292
typedef LLRectBase<F32> LLRectf;
297293

294+
static_assert(std::is_trivially_copyable<LLRect>::value, "LLRect must be trivial copy");
295+
static_assert(std::is_trivially_move_assignable<LLRect>::value, "LLRect must be trivial move");
296+
static_assert(std::is_standard_layout<LLRect>::value, "LLRect must be a standard layout type");
297+
298298
#endif

indra/llmath/llsimdtypes.h

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ typedef __m128 LLQuad;
3636
class LLBool32
3737
{
3838
public:
39-
inline LLBool32() {}
39+
inline LLBool32() = default;
4040
inline LLBool32(int rhs) : m_bool(rhs) {}
4141
inline LLBool32(unsigned int rhs) : m_bool(rhs) {}
4242
inline LLBool32(bool rhs) { m_bool = static_cast<const int>(rhs); }
@@ -46,13 +46,15 @@ class LLBool32
4646
inline operator bool() const { return static_cast<const bool&>(m_bool); }
4747

4848
private:
49-
int m_bool{ 0 };
49+
int m_bool;
5050
};
5151

52+
static_assert(std::is_trivial<LLBool32>::value, "LLBool32 must be a standard layout type");
53+
5254
class LLSimdScalar
5355
{
5456
public:
55-
inline LLSimdScalar() {}
57+
inline LLSimdScalar() = default;
5658
inline LLSimdScalar(LLQuad q)
5759
{
5860
mQ = q;
@@ -100,7 +102,9 @@ class LLSimdScalar
100102
}
101103

102104
private:
103-
LLQuad mQ{};
105+
LLQuad mQ;
104106
};
105107

108+
static_assert(std::is_trivial<LLSimdScalar>::value, "LLSimdScalar must be a standard layout type");
109+
106110
#endif //LL_SIMD_TYPES_H

0 commit comments

Comments
 (0)