diff --git a/gfx/2d/BasePoint.h b/gfx/2d/BasePoint.h index 5938855f5bd4..72b0f7556f3a 100644 --- a/gfx/2d/BasePoint.h +++ b/gfx/2d/BasePoint.h @@ -22,7 +22,12 @@ namespace gfx { */ template struct BasePoint { - T x, y; + union { + struct { + T x, y; + }; + T components[2]; + }; // Constructors MOZ_CONSTEXPR BasePoint() : x(0), y(0) {} diff --git a/gfx/2d/BasePoint3D.h b/gfx/2d/BasePoint3D.h index 4deeaf00de17..41e387576850 100644 --- a/gfx/2d/BasePoint3D.h +++ b/gfx/2d/BasePoint3D.h @@ -18,7 +18,12 @@ namespace gfx { */ template struct BasePoint3D { - T x, y, z; + union { + struct { + T x, y, z; + }; + T components[3]; + }; // Constructors BasePoint3D() : x(0), y(0), z(0) {} diff --git a/gfx/2d/BasePoint4D.h b/gfx/2d/BasePoint4D.h index 37e93f64746d..3f4d71011062 100644 --- a/gfx/2d/BasePoint4D.h +++ b/gfx/2d/BasePoint4D.h @@ -18,7 +18,12 @@ namespace gfx { */ template struct BasePoint4D { - T x, y, z, w; + union { + struct { + T x, y, z, w; + }; + T components[4]; + }; // Constructors BasePoint4D() : x(0), y(0), z(0), w(0) {} diff --git a/gfx/2d/BaseSize.h b/gfx/2d/BaseSize.h index 5048885e4dc8..62e47a2bb5c3 100644 --- a/gfx/2d/BaseSize.h +++ b/gfx/2d/BaseSize.h @@ -18,7 +18,12 @@ namespace gfx { */ template struct BaseSize { - T width, height; + union { + struct { + T width, height; + }; + T components[2]; + }; // Constructors MOZ_CONSTEXPR BaseSize() : width(0), height(0) {} diff --git a/gfx/2d/Matrix.h b/gfx/2d/Matrix.h index b036989da141..2c4b104a90f2 100644 --- a/gfx/2d/Matrix.h +++ b/gfx/2d/Matrix.h @@ -37,9 +37,14 @@ public: , _21(a21), _22(a22) , _31(a31), _32(a32) {} - Float _11, _12; - Float _21, _22; - Float _31, _32; + union { + struct { + Float _11, _12; + Float _21, _22; + Float _31, _32; + }; + Float components[6]; + }; MOZ_ALWAYS_INLINE Matrix Copy() const { @@ -461,10 +466,15 @@ public: memcpy(this, &aOther, sizeof(*this)); } - Float _11, _12, _13, _14; - Float _21, _22, _23, _24; - Float _31, _32, _33, _34; - Float _41, _42, _43, _44; + union { + struct { + Float _11, _12, _13, _14; + Float _21, _22, _23, _24; + Float _31, _32, _33, _34; + Float _41, _42, _43, _44; + }; + Float components[16]; + }; friend std::ostream& operator<<(std::ostream& aStream, const Matrix4x4Typed& aMatrix) { @@ -1618,11 +1628,16 @@ public: return *this; } - Float _11, _12, _13, _14; - Float _21, _22, _23, _24; - Float _31, _32, _33, _34; - Float _41, _42, _43, _44; - Float _51, _52, _53, _54; + union { + struct { + Float _11, _12, _13, _14; + Float _21, _22, _23, _24; + Float _31, _32, _33, _34; + Float _41, _42, _43, _44; + Float _51, _52, _53, _54; + }; + Float components[20]; + }; }; } // namespace gfx