diff --git a/glm/detail/simd_constexpr/element.hpp b/glm/detail/simd_constexpr/element.hpp index e5098dd0..4a0483f1 100644 --- a/glm/detail/simd_constexpr/element.hpp +++ b/glm/detail/simd_constexpr/element.hpp @@ -2,6 +2,16 @@ namespace glm::detail { consteval bool NotEmpty(length_t I, length_t L) { return I <= L; } + struct Empty {}; + struct RowTwo { + [[no_unique_address]] Empty y; [[no_unique_address]] Empty g; [[no_unique_address]] Empty t; + }; + struct RowThree { + [[no_unique_address]] Empty z; [[no_unique_address]] Empty b; [[no_unique_address]] Empty p; + }; + struct RowFour { + [[no_unique_address]] Empty w; [[no_unique_address]] Empty a; [[no_unique_address]] Empty q; + }; template struct ElementCollection; template @@ -21,9 +31,11 @@ namespace glm::detail template - struct ElementCollection { + struct ElementCollection : RowFour { using data_t = typename detail::storage<3, T, detail::is_aligned::value>::type; - struct w {}; struct a {}; struct q{}; + using RowFour::w; + using RowFour::a; + using RowFour::q; union { struct { @@ -35,10 +47,14 @@ namespace glm::detail }; }; template - struct ElementCollection { + struct ElementCollection : RowThree, RowFour { using data_t = typename detail::storage<2, T, detail::is_aligned::value>::type; - struct z {}; struct b {}; struct p{}; - struct w {}; struct a {}; struct q{}; + using RowThree::z; + using RowThree::b; + using RowThree::p; + using RowFour::w; + using RowFour::a; + using RowFour::q; union { struct { @@ -49,11 +65,17 @@ namespace glm::detail }; }; template - struct ElementCollection { + struct ElementCollection : RowTwo, RowThree, RowFour { using data_t = typename detail::storage<1, T, detail::is_aligned::value>::type; - struct y {}; struct g {}; struct t{}; - struct z {}; struct b {}; struct p{}; - struct w {}; struct a {}; struct q{}; + using RowTwo::y; + using RowTwo::g; + using RowTwo::t; + using RowThree::z; + using RowThree::b; + using RowThree::p; + using RowFour::w; + using RowFour::a; + using RowFour::q; union { struct { diff --git a/glm/detail/simd_constexpr/vec.hpp b/glm/detail/simd_constexpr/vec.hpp index 92f45f3e..a730dae1 100644 --- a/glm/detail/simd_constexpr/vec.hpp +++ b/glm/detail/simd_constexpr/vec.hpp @@ -121,18 +121,18 @@ namespace glm struct vec : detail::ElementCollection { // -- Data -- - using EC::x; - using EC::y; - using EC::z; - using EC::w; - using EC::r; - using EC::g; - using EC::b; - using EC::a; - using EC::s; - using EC::t; - using EC::p; - using EC::q; + using detail::ElementCollection::x; + using detail::ElementCollection::y; + using detail::ElementCollection::z; + using detail::ElementCollection::w; + using detail::ElementCollection::r; + using detail::ElementCollection::g; + using detail::ElementCollection::b; + using detail::ElementCollection::a; + using detail::ElementCollection::s; + using detail::ElementCollection::t; + using detail::ElementCollection::p; + using detail::ElementCollection::q; using SimdHlp = detail::SimdHelpers; using DataArray = VecDataArray; @@ -596,7 +596,7 @@ namespace glm } template - inline GLM_CONSTEXPR vec & operator|=(vec<1, Tx, Q> const& v) requires (NotVec1) + inline GLM_CONSTEXPR vec & operator|=(vec<1, Tx, Q> v) requires (NotVec1) { if constexpr (L < 3) { this->data |= v.data; @@ -606,7 +606,7 @@ namespace glm } template - inline GLM_CONSTEXPR vec & operator|=(vec const& v) + inline GLM_CONSTEXPR vec & operator|=(vec v) { if constexpr (L < 3) { this->data |= v.data; @@ -625,7 +625,7 @@ namespace glm } template - inline GLM_CONSTEXPR vec & operator^=(vec<1, Tx, Q> const& v) requires (NotVec1) + inline GLM_CONSTEXPR vec & operator^=(vec<1, Tx, Q> v) requires (NotVec1) { if constexpr (L < 3) { this->data ^= v.data; @@ -635,7 +635,7 @@ namespace glm } template - inline GLM_CONSTEXPR vec & operator^=(vec const& v) + inline GLM_CONSTEXPR vec & operator^=(vec v) { return (*this = detail::compute_vec_xor::value, sizeof(T) * 8, detail::is_aligned::value>::call(*this, vec(v))); } @@ -650,7 +650,7 @@ namespace glm } template - inline GLM_CONSTEXPR vec & operator<<=(vec<1, Tx, Q> const& v) requires (NotVec1) + inline GLM_CONSTEXPR vec & operator<<=(vec<1, Tx, Q> v) requires (NotVec1) { if constexpr (L < 3) { this->data <<= v.data; @@ -660,7 +660,7 @@ namespace glm } template - inline GLM_CONSTEXPR vec & operator<<=(vec const& v) + inline GLM_CONSTEXPR vec & operator<<=(vec v) { if constexpr (L < 3) { this->data <<= v.data; @@ -679,7 +679,7 @@ namespace glm } template - inline GLM_CONSTEXPR vec & operator>>=(vec<1, Tx, Q> const& v) requires (NotVec1) + inline GLM_CONSTEXPR vec & operator>>=(vec<1, Tx, Q> v) requires (NotVec1) { if constexpr (L < 3) { this->data >>= v.data; @@ -689,7 +689,7 @@ namespace glm } template - inline GLM_CONSTEXPR vec & operator>>=(vec const& v) + inline GLM_CONSTEXPR vec & operator>>=(vec v) { if constexpr (L < 3) { this->data >>= v.data; @@ -718,17 +718,17 @@ namespace glm } template - inline GLM_CONSTEXPR vec operator+(vec const& v2) requires (!NotVec1 && NotVec1) + inline GLM_CONSTEXPR vec operator+(vec v2) requires (!NotVec1 && NotVec1) { return vec(*this) += v2; } - friend inline GLM_CONSTEXPR vec operator+(T scalar, vec const& v) + friend inline GLM_CONSTEXPR vec operator+(T scalar, vec v) { return vec(v) += scalar; } - friend inline GLM_CONSTEXPR vec operator+(vec<1, T, Q> const& v1, vec const& v2) + friend inline GLM_CONSTEXPR vec operator+(vec<1, T, Q> v1, vec v2) { return vec(v2) += v1; } @@ -744,22 +744,22 @@ namespace glm } template - inline GLM_CONSTEXPR vec operator-(vec const& v2) requires (!NotVec1 && NotVec1) + inline GLM_CONSTEXPR vec operator-(vec v2) requires (!NotVec1 && NotVec1) { return vec(*this) -= v2; } - friend inline GLM_CONSTEXPR vec operator-(T scalar, vec const& v) + friend inline GLM_CONSTEXPR vec operator-(T scalar, vec v) { return vec(scalar) -= v; } - friend inline GLM_CONSTEXPR vec operator-(vec<1, T, Q> const& v1, vec const& v2) requires (NotVec1) + friend inline GLM_CONSTEXPR vec operator-(vec<1, T, Q> v1, vec v2) requires (NotVec1) { return vec(v1.x) -= v2; } - friend inline GLM_CONSTEXPR vec operator-(vec const& v1, vec const& v2) + friend inline GLM_CONSTEXPR vec operator-(vec v1, vec v2) { return vec(v1) -= v2; } @@ -770,25 +770,25 @@ namespace glm } template - inline GLM_CONSTEXPR vec operator*(vec const& v2) requires (!NotVec1 && NotVec1) + inline GLM_CONSTEXPR vec operator*(vec v2) requires (!NotVec1 && NotVec1) { return vec(*this) *= v2; } - friend inline GLM_CONSTEXPR vec operator*(T scalar, vec const& v) + friend inline GLM_CONSTEXPR vec operator*(T scalar, vec v) { return vec(v) *= scalar; } - friend inline GLM_CONSTEXPR vec operator*(vec<1, T, Q> const& v1, vec const& v2) requires (NotVec1) + friend inline GLM_CONSTEXPR vec operator*(vec<1, T, Q> v1, vec v2) requires (NotVec1) { return vec(v2) *= v1; } - friend inline GLM_CONSTEXPR vec operator*(vec const& v1, vec const& v2) + friend inline GLM_CONSTEXPR vec operator*(vec v1, vec v2) { return vec(v1) *= v2; } @@ -801,25 +801,25 @@ namespace glm template - inline GLM_CONSTEXPR vec operator/(vec const& v2) requires (!NotVec1 && NotVec1) + inline GLM_CONSTEXPR vec operator/(vec v2) requires (!NotVec1 && NotVec1) { return vec(*this) /= v2; } - friend inline GLM_CONSTEXPR vec operator/(T scalar, vec const& v) + friend inline GLM_CONSTEXPR vec operator/(T scalar, vec v) { return vec(scalar) /= v; } template - friend inline GLM_CONSTEXPR vec operator/(vec const& v1, vec const& v2) requires (!NotVec1 && NotVec1) + friend inline GLM_CONSTEXPR vec operator/(vec v1, vec v2) requires (!NotVec1 && NotVec1) { return vec(v1.x) /= v2; } - friend inline GLM_CONSTEXPR vec operator/(vec const& v1, vec const& v2) + friend inline GLM_CONSTEXPR vec operator/(vec v1, vec v2) { return vec(v1) /= v2; } @@ -827,212 +827,212 @@ namespace glm // -- Binary bit operators -- - friend inline GLM_CONSTEXPR vec operator%(vec const& v, T scalar) + friend inline GLM_CONSTEXPR vec operator%(vec v, T scalar) { return vec(v) %= scalar; } template - inline GLM_CONSTEXPR vec operator%(vec const& v2) requires (!NotVec1 && NotVec1) + inline GLM_CONSTEXPR vec operator%(vec v2) requires (!NotVec1 && NotVec1) { return vec(*this) %= v2.x; } - friend inline GLM_CONSTEXPR vec operator%(T scalar, vec const& v) + friend inline GLM_CONSTEXPR vec operator%(T scalar, vec v) { return vec(scalar) %= v; } - friend inline GLM_CONSTEXPR vec operator%(vec<1, T, Q> const& scalar, vec const& v) requires (NotVec1) + friend inline GLM_CONSTEXPR vec operator%(vec<1, T, Q> scalar, vec v) requires (NotVec1) { return vec(scalar.x) %= v; } - friend inline GLM_CONSTEXPR vec operator%(vec const& v1, vec const& v2) + friend inline GLM_CONSTEXPR vec operator%(vec v1, vec v2) { return vec(v1) %= v2; } - friend inline GLM_CONSTEXPR vec operator&(vec const& v, T scalar) + friend inline GLM_CONSTEXPR vec operator&(vec v, T scalar) { return vec(v) &= scalar; } - inline GLM_CONSTEXPR vec operator&(vec<1, T, Q> const& scalar) requires (NotVec1) + inline GLM_CONSTEXPR vec operator&(vec<1, T, Q> scalar) requires (NotVec1) { return vec(*this) &= scalar; } - friend inline GLM_CONSTEXPR vec operator&(T scalar, vec const& v) + friend inline GLM_CONSTEXPR vec operator&(T scalar, vec v) { return vec(scalar) &= v; } - friend inline GLM_CONSTEXPR vec operator&(vec<1, T, Q> const& v1, vec const& v2) requires (NotVec1) + friend inline GLM_CONSTEXPR vec operator&(vec<1, T, Q> v1, vec v2) requires (NotVec1) { return vec(v1.x) &= v2; } - friend inline GLM_CONSTEXPR vec operator&(vec const& v1, vec const& v2) + friend inline GLM_CONSTEXPR vec operator&(vec v1, vec v2) { return vec(v1) &= v2; } - friend inline GLM_CONSTEXPR vec operator|(vec const& v, T scalar) + friend inline GLM_CONSTEXPR vec operator|(vec v, T scalar) { return vec(v) |= scalar; } template - inline GLM_CONSTEXPR vec operator|(vec const& v2) requires (!NotVec1 && NotVec1) + inline GLM_CONSTEXPR vec operator|(vec v2) requires (!NotVec1 && NotVec1) { return vec(*this) |= v2.x; } - friend inline GLM_CONSTEXPR vec operator|(T scalar, vec const& v) + friend inline GLM_CONSTEXPR vec operator|(T scalar, vec v) { return vec(scalar) |= v; } - friend inline GLM_CONSTEXPR vec operator|(vec<1, T, Q> const& v1, vec const& v2) requires (NotVec1) + friend inline GLM_CONSTEXPR vec operator|(vec<1, T, Q> v1, vec v2) requires (NotVec1) { return vec(v1.x) |= v2; } - friend inline GLM_CONSTEXPR vec operator|(vec const& v1, vec const& v2) + friend inline GLM_CONSTEXPR vec operator|(vec v1, vec v2) { return vec(v1) |= v2; } - friend inline GLM_CONSTEXPR vec operator^(vec const& v, T scalar) + friend inline GLM_CONSTEXPR vec operator^(vec v, T scalar) { return vec(v) ^= scalar; } template - inline GLM_CONSTEXPR vec operator^(vec const& v2) requires (!NotVec1 && NotVec1) + inline GLM_CONSTEXPR vec operator^(vec v2) requires (!NotVec1 && NotVec1) { return vec(*this) ^= v2.x; } - friend inline GLM_CONSTEXPR vec operator^(T scalar, vec const& v) + friend inline GLM_CONSTEXPR vec operator^(T scalar, vec v) { return vec(scalar) ^= v; } - friend inline GLM_CONSTEXPR vec operator^(vec<1, T, Q> const& v1, vec const& v2) requires (NotVec1) + friend inline GLM_CONSTEXPR vec operator^(vec<1, T, Q> v1, vec v2) requires (NotVec1) { return vec(v1.x) ^= v2; } - friend inline GLM_CONSTEXPR vec operator^(vec const& v1, vec const& v2) + friend inline GLM_CONSTEXPR vec operator^(vec v1, vec v2) { return vec(v1) ^= v2; } - friend inline GLM_CONSTEXPR vec operator<<(vec const& v, T scalar) + friend inline GLM_CONSTEXPR vec operator<<(vec v, T scalar) { return vec(v) <<= scalar; } template - inline GLM_CONSTEXPR vec operator<<(vec const& v2) requires (!NotVec1 && NotVec1) + inline GLM_CONSTEXPR vec operator<<(vec v2) requires (!NotVec1 && NotVec1) { return vec(*this) <<= v2.x; } - friend inline GLM_CONSTEXPR vec operator<<(T scalar, vec const& v) + friend inline GLM_CONSTEXPR vec operator<<(T scalar, vec v) { return vec(scalar) <<= v; } - friend inline GLM_CONSTEXPR vec operator<<(vec<1, T, Q> const& v1, vec const& v2) requires (NotVec1) + friend inline GLM_CONSTEXPR vec operator<<(vec<1, T, Q> v1, vec v2) requires (NotVec1) { return vec(v1.x) <<= v2; } - friend inline GLM_CONSTEXPR vec operator<<(vec const& v1, vec const& v2) + friend inline GLM_CONSTEXPR vec operator<<(vec v1, vec v2) { return vec(v1) <<= v2; } - friend inline GLM_CONSTEXPR vec operator>>(vec const& v, T scalar) + friend inline GLM_CONSTEXPR vec operator>>(vec v, T scalar) { return vec(v) >>= scalar; } template - inline GLM_CONSTEXPR vec operator>>(vec const& v2) requires (!NotVec1 && NotVec1) + inline GLM_CONSTEXPR vec operator>>(vec v2) requires (!NotVec1 && NotVec1) { return vec(*this) >>= v2.x; } - friend inline GLM_CONSTEXPR vec operator>>(T scalar, vec const& v) + friend inline GLM_CONSTEXPR vec operator>>(T scalar, vec v) { return vec(scalar) >>= v; } - friend inline GLM_CONSTEXPR vec operator>>(vec<1, T, Q> const& v1, vec const& v2) requires (NotVec1) + friend inline GLM_CONSTEXPR vec operator>>(vec<1, T, Q> v1, vec v2) requires (NotVec1) { return vec(v1.x) >>= v2; } - friend inline GLM_CONSTEXPR vec operator>>(vec const& v1, vec const& v2) + friend inline GLM_CONSTEXPR vec operator>>(vec v1, vec v2) { return vec(v1) >>= v2; } - friend inline GLM_CONSTEXPR vec operator~(vec const& v) + friend inline GLM_CONSTEXPR vec operator~(vec v) { return detail::compute_vec_bitwise_not<4, T, Q, detail::is_int::value, sizeof(T) * 8, detail::is_aligned::value>::call(v); } // -- Boolean operators -- - friend inline GLM_CONSTEXPR bool operator==(vec const& v1, vec const& v2) + friend inline GLM_CONSTEXPR bool operator==(vec v1, vec v2) { return detail::compute_vec_equal<4, T, Q, detail::is_int::value, sizeof(T) * 8, detail::is_aligned::value>::call(v1, v2); } - friend inline GLM_CONSTEXPR bool operator!=(vec const& v1, vec const& v2) + friend inline GLM_CONSTEXPR bool operator!=(vec v1, vec v2) { return detail::compute_vec_nequal<4, T, Q, detail::is_int::value, sizeof(T) * 8, detail::is_aligned::value>::call(v1, v2); } }; template requires (std::is_same_v) - inline GLM_CONSTEXPR vec operator&&(vec const& v1, vec const& v2) + inline GLM_CONSTEXPR vec operator&&(vec v1, vec v2) { return vec(v1.x && v2.x, v1.y && v2.y, v1.z && v2.z, v1.w && v2.w); } template requires (std::is_same_v) - inline GLM_CONSTEXPR vec operator||(vec const& v1, vec const& v2) + inline GLM_CONSTEXPR vec operator||(vec v1, vec v2) { return vec(v1.x || v2.x, v1.y || v2.y, v1.z || v2.z, v1.w || v2.w); }