simd constexpr vec: fix all the compile errors

This commit is contained in:
sharkautarch 2024-09-11 13:40:08 -04:00
parent 02a5163276
commit 8e86332b6b
No known key found for this signature in database
GPG Key ID: F270CA9462164405
11 changed files with 208 additions and 177 deletions

View File

@ -39,49 +39,49 @@ namespace glm::detail
{
return *this;
}
constexpr decltype(auto) operator+=(auto a) requires requires (T first, decltype(rhs) r) { first + r; }
constexpr decltype(auto) operator+=(auto rhs) requires requires (T first, decltype(rhs) r) { first + r; }
{
return *this;
}
constexpr decltype(auto) operator-=(auto a) requires requires (T first, decltype(rhs) r) { first - r; }
constexpr decltype(auto) operator-=(auto rhs) requires requires (T first, decltype(rhs) r) { first - r; }
{
return *this;
}
constexpr decltype(auto) operator*=(auto a) requires requires (T first, decltype(rhs) r) { first * r; }
constexpr decltype(auto) operator*=(auto rhs) requires requires (T first, decltype(rhs) r) { first * r; }
{
return *this;
}
constexpr decltype(auto) operator/=(auto a) requires requires (T first, decltype(rhs) r) { first / r; }
constexpr decltype(auto) operator/=(auto rhs) requires requires (T first, decltype(rhs) r) { first / r; }
{
return *this;
}
constexpr decltype(auto) operator%=(auto a) requires requires (T first, decltype(rhs) r) { first % r; }
constexpr decltype(auto) operator%=(auto rhs) requires requires (T first, decltype(rhs) r) { first % r; }
{
return *this;
}
constexpr decltype(auto) operator&=(auto a) requires requires (T first, decltype(rhs) r) { first & r; }
constexpr decltype(auto) operator&=(auto rhs) requires requires (T first, decltype(rhs) r) { first & r; }
{
return *this;
}
constexpr decltype(auto) operator|=(auto a) requires requires (T first, decltype(rhs) r) { first | r; }
constexpr decltype(auto) operator|=(auto rhs) requires requires (T first, decltype(rhs) r) { first | r; }
{
return *this;
}
constexpr decltype(auto) operator^=(auto a) requires requires (T first, decltype(rhs) r) { first ^ r; }
constexpr decltype(auto) operator^=(auto rhs) requires requires (T first, decltype(rhs) r) { first ^ r; }
{
return *this;
}
constexpr decltype(auto) operator<<=(auto a) requires requires (T first, decltype(rhs) r) { first << r; }
constexpr decltype(auto) operator<<=(auto rhs) requires requires (T first, decltype(rhs) r) { first << r; }
{
return *this;
}
constexpr decltype(auto) operator>>=(auto a) requires requires (T first, decltype(rhs) r) { first >> r; }
constexpr decltype(auto) operator>>=(auto rhs) requires requires (T first, decltype(rhs) r) { first >> r; }
{
return *this;
}
@ -141,12 +141,12 @@ namespace glm::detail
return false;
}
constexpr decltype(auto) operator!(auto rhs) requires requires (T first) { !first; }
constexpr decltype(auto) operator!() requires requires (T first) { !first; }
{
return false;
}
constexpr decltype(auto) operator bool() requires requires (T first) { !!first; }
constexpr operator bool() requires requires (T first) { !!first; }
{
return false;
}
@ -161,7 +161,7 @@ namespace glm::detail
return 0;
}
constexpr decltype(auto) operator&(); requires requires (T first) { &first; }
constexpr decltype(auto) operator&() requires requires (T first) { &first; }
{
return nullptr;
}
@ -181,6 +181,11 @@ namespace glm::detail
{
return t;
}
constexpr operator auto() const
{
return t;
}
constexpr decltype(auto) operator=(auto thing)
{
t=(T)thing;
@ -219,60 +224,60 @@ namespace glm::detail
operator--(); // prefix decrement
return old; // return old value
}
constexpr decltype(auto) operator+=(auto a) requires requires (T first, decltype(rhs) r) { first + r; }
constexpr decltype(auto) operator+=(auto rhs) requires requires (T first, decltype(rhs) r) { first + r; }
{
t+=a;
t+=rhs;
return *this;
}
constexpr decltype(auto) operator-=(auto a) requires requires (T first, decltype(rhs) r) { first - r; }
constexpr decltype(auto) operator-=(auto rhs) requires requires (T first, decltype(rhs) r) { first - r; }
{
t-=a;
t-=rhs;
return *this;
}
constexpr decltype(auto) operator*=(auto a) requires requires (T first, decltype(rhs) r) { first * r; }
constexpr decltype(auto) operator*=(auto rhs) requires requires (T first, decltype(rhs) r) { first * r; }
{
t*=a;
t*=rhs;
return *this;
}
constexpr decltype(auto) operator/=(auto a) requires requires (T first, decltype(rhs) r) { first / r; }
constexpr decltype(auto) operator/=(auto rhs) requires requires (T first, decltype(rhs) r) { first / r; }
{
t/=a;
t/=rhs;
return *this;
}
constexpr decltype(auto) operator%=(auto a) requires requires (T first, decltype(rhs) r) { first % r; }
constexpr decltype(auto) operator%=(auto rhs) requires requires (T first, decltype(rhs) r) { first % r; }
{
t%=a;
t%=rhs;
return *this;
}
constexpr decltype(auto) operator&=(auto a) requires requires (T first, decltype(rhs) r) { first & r; }
constexpr decltype(auto) operator&=(auto rhs) requires requires (T first, decltype(rhs) r) { first & r; }
{
t&=a;
t&=rhs;
return *this;
}
constexpr decltype(auto) operator|=(auto a) requires requires (T first, decltype(rhs) r) { first | r; }
constexpr decltype(auto) operator|=(auto rhs) requires requires (T first, decltype(rhs) r) { first | r; }
{
t|=a;
t|=rhs;
return *this;
}
constexpr decltype(auto) operator^=(auto a) requires requires (T first, decltype(rhs) r) { first ^ r; }
constexpr decltype(auto) operator^=(auto rhs) requires requires (T first, decltype(rhs) r) { first ^ r; }
{
t^=a;
t^=rhs;
return *this;
}
constexpr decltype(auto) operator<<=(auto a) requires requires (T first, decltype(rhs) r) { first << r; }
constexpr decltype(auto) operator<<=(auto rhs) requires requires (T first, decltype(rhs) r) { first << r; }
{
t<<=a;
t<<=rhs;
return *this;
}
constexpr decltype(auto) operator>>=(auto a) requires requires (T first, decltype(rhs) r) { first >> r; }
constexpr decltype(auto) operator>>=(auto rhs) requires requires (T first, decltype(rhs) r) { first >> r; }
{
t>>=a;
t>>=rhs;
return *this;
}
@ -363,7 +368,7 @@ namespace glm::detail
return !lhs.t;
}
constexpr decltype(auto) operator bool() requires requires (T first) { !!first; }
constexpr operator bool() requires requires (T first) { !!first; }
{
auto lhs = *this;
return !!lhs.t;
@ -381,9 +386,9 @@ namespace glm::detail
return -lhs.t;
}
constexpr decltype(auto) operator&(); requires requires (T first) { &first; }
constexpr decltype(auto) operator&() requires requires (T first) { &first; }
{
return &(this->t);
return &(t);
}
constexpr decltype(auto) operator<=>(auto rhs) requires requires (T first, decltype(rhs) r) { first <=> r; }

View File

@ -3,11 +3,17 @@ namespace glm::detail
template<length_t L, typename T, qualifier Q>
struct SimdHelpers
{
using PaddedVec = PaddedGccVec<L, T, Q>;
using gcc_vec_t = PaddedVec::GccV;
template <typename Tx0, typename... Tx>
struct GetFirstType
{
using FirstTx = Tx0;
};
template <length_t Lx, typename Tx, qualifier Qx>
using PaddedVec = PaddedGccVec<Lx, Tx, Qx, detail::BVecNeedsPadding<Lx, Tx, Qx>()>;
using gcc_vec_t = PaddedVec<L, T, Q>::GccV;
using data_t = typename detail::storage<L, T, detail::is_aligned<Q>::value>::type;
static inline auto simd_ctor_scalar(arithmetic auto scalar) {
PaddedVec v = {};
PaddedVec<L, T, Q> v = {};
v.gcc_vec = v.gcc_vec + ( (T)scalar );
return std::bit_cast<data_t>(v);
}
@ -15,38 +21,39 @@ namespace glm::detail
template <length_t Lx, typename Tx, qualifier Qx> requires (Lx == L)
static inline auto simd_ctor(::glm::vec<Lx, Tx, Qx> v)
{
using OtherPaddedVec = PaddedGccVec<Lx, Tx, Qx>;
using OtherPaddedVec = PaddedVec<Lx, Tx, Qx>;
OtherPaddedVec o = std::bit_cast<OtherPaddedVec>(v.data);
PaddedVec converted = {.gcc_vec=__builtin_convertvector(o.gcc_vec, gcc_vec_t)};
PaddedVec<L, T, Q> converted = {.gcc_vec=__builtin_convertvector(o.gcc_vec, gcc_vec_t)};
return std::bit_cast<data_t>(converted);
}
template <length_t Lx, typename Tx, qualifier Qx> requires (Lx != L && Lx < L)
static inline auto simd_ctor(::glm::vec<Lx, Tx, Qx> v)
{
using OtherPaddedVec = PaddedGccVec<Lx, Tx, Qx>;
using OurSizeTheirType = PaddedGccVec<L, Tx, Qx>;
using OtherPaddedVec = PaddedVec<Lx, Tx, Qx>;
using OurSizeTheirType = PaddedVec<L, Tx, Qx>;
OtherPaddedVec o = std::bit_cast<OtherPaddedVec>(v.data);
OurSizeTheirType oExpanded = {};
for (length_t i = 0; i < Lx; i++) {
oExpanded.gcc_vec[i] = o.gcc_vec[i];
}
PaddedVec converted = {.gcc_vec=__builtin_convertvector(oExpanded.gcc_vec, gcc_vec_t)};
PaddedVec<L, T, Q> converted = {.gcc_vec=__builtin_convertvector(oExpanded.gcc_vec, gcc_vec_t)};
return std::bit_cast<data_t>(converted);
}
static consteval bool isLengthOfVector(arithmetic auto... scalars) {
return sizeof...(scalars) == L;
template<arithmetic... A>
static consteval bool isLengthOfVector() {
return sizeof...(A) == L;
}
template <arithmetic... A>
static inline auto simd_ctor_multi_scalars(A... scalars) requires ( isLengthOfVector(scalars...) && SameArithmeticTypes<A...>())
static inline auto simd_ctor_multi_scalars(A... scalars) requires ( isLengthOfVector<A...>() && SameArithmeticTypes<A...>())
{
//assuming that number of scalars is always the same as the length of the to-be-constructed vector
using OtherPaddedVec = PaddedGccVec<L, A, Q>;
using OtherPaddedVec = PaddedVec<L, typename GetFirstType<A...>::FirstTx, Q>;
OtherPaddedVec o = {.gcc_vec={scalars...}};
PaddedVec converted = {.gcc_vec=__builtin_convertvector(o, gcc_vec_t)};
PaddedVec<L, T, Q> converted = {.gcc_vec=__builtin_convertvector(o.gcc_vec, gcc_vec_t)};
return std::bit_cast<data_t>(converted);
}
};

View File

@ -31,7 +31,7 @@ namespace glm
}
template <typename... T>
consteval bool NotSameArithmeticTypes() {
return ( (!(std::is_integral_v<T> || std::floating_point_v<T>) || ...) || !(SameArithmeticTypes<T...>()) );
return ( (!(std::is_integral_v<T> || std::is_floating_point_v<T>) || ...) || !(SameArithmeticTypes<T...>()) );
}
namespace detail
@ -96,6 +96,8 @@ namespace glm
}
#include "element.hpp"
#include "simd_helpers.inl"
#include "../compute_vector_relational.hpp"
#include "../compute_vector_decl.hpp"
namespace glm
{
template<length_t L, typename T, qualifier Q>
@ -117,26 +119,24 @@ namespace glm
};
// -- Component Access --
static constexpr length_t length(){ return L; }
static consteval length_t length(){ return L; }
GLM_FUNC_QUALIFIER GLM_CONSTEXPR decltype(auto) operator[](length_t i)
inline GLM_CONSTEXPR T& operator[](length_t i)
{
if (std::is_constant_evaluated()) {
static_assert(i <= length());
} else {
GLM_ASSERT_LENGTH(i, this->length());
if (!std::is_constant_evaluated()) {
GLM_ASSERT_LENGTH(i, L);
}
switch (i)
switch (std::max(i, length()))
{
default:
case 0:
return x;
case 1:
return y;
return y.t;
case 2:
return z;
return z.t;
case 3:
return w;
return w.t;
}
}
@ -148,7 +148,7 @@ namespace glm
union
{
struct {
union { E<1> x, r, s; };
union { T x, r, s; };
GLM_N union { GLM_N E<2> y; GLM_N E<2> g; GLM_N E<2> t; };
GLM_N union { GLM_N E<3> z; GLM_N E<3> b; GLM_N E<3> p; };
GLM_N union { GLM_N E<4> w; GLM_N E<4> a; GLM_N E<4> q; };
@ -205,9 +205,9 @@ namespace glm
constexpr auto ctor(VecGetter vecGetter) {
if (std::is_constant_evaluated()) {
DataArray a = {};
constexpr auto v = vecGetter();
auto v = vecGetter();
constexpr length_t vL = v.length();
using ArrX = VecDataArray<vL, decltype(v)::value_type, decltype(v)::k_qual>;
using ArrX = VecDataArray<vL, typename decltype(v)::value_type, decltype(v)::k_qual>;
ArrX ax = std::bit_cast<ArrX>(v.data);
for (length_t i = 0; i < v.length(); i++) {
a.p[i] = (T)ax.p[i];
@ -242,12 +242,13 @@ namespace glm
}
return var_t{RetPair{a, i}};
}
};
constexpr vec(arithmetic auto scalar) : data{ [scalar](){ auto s = [scalar](){ return scalar; }; return ctor_scalar(s); }() } {}
constexpr vec() : data{} {}
constexpr vec(arithmetic auto scalar) : data{ [scalar,this](){ auto s = [scalar](){ return scalar; }; return ctor_scalar(s); }() } {}
template <length_t Lx, typename Tx, qualifier Qx>
constexpr vec(vec<Lx, Tx, Qx> v) : data{ [v](){ auto vv = [v](){ return v; }; return ctor(vv); }() } {}
constexpr vec(vec<Lx, Tx, Qx> v) : data{ [v, this](){ auto vv = [v](){ return v; }; return ctor(vv); }() } {}
template <arithmetic... Scalar> requires (sizeof...(Scalar) == L)
constexpr vec(Scalar... scalar)
@ -274,7 +275,7 @@ namespace glm
length_t i = 0;
using var_t = std::variant<RetPair, VecOrScalar...>;
for (auto var_vs : std::array<var_t, sizeof...(vecOrScalar)>{ vecOrScalar... } ) {
auto visitee = [i](auto&& arg) -> var_t { return ctor_mixed_constexpr_single<var_t>(arg, i); };
auto visitee = [i](auto&& arg) -> var_t { return ctor_mixed_constexpr_single.template operator()<var_t>(arg, i); };
RetPair pair = std::get<RetPair>(std::visit(visitee, var_vs));
for (length_t j = pair.i; j < i+pair.i; j++) {
a.p[j] = pair.a.p[j];
@ -288,84 +289,84 @@ namespace glm
// -- Unary arithmetic operators --
template <length_t Lx, typename Tx, qualifier Qx>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> operator=(vec<Lx, Tx, Qx> v)
inline GLM_CONSTEXPR vec<L, T, Q> operator=(vec<Lx, Tx, Qx> v)
{
*this = vec<L, T, Q>(v);
return *this;
}
GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q>& operator+=(arithmetic auto scalar)
inline GLM_CONSTEXPR vec<L, T, Q>& operator+=(arithmetic auto scalar)
{
return (*this = detail::compute_vec_add<L, T, Q, detail::is_aligned<Q>::value>::call(*this, vec<L, T, Q>(scalar)));
}
template<typename Tx>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> & operator+=(vec<1, Tx, Q> v)
inline GLM_CONSTEXPR vec<L, T, Q> & operator+=(vec<1, Tx, Q> v)
{
return (*this = detail::compute_vec_add<L, T, Q, detail::is_aligned<Q>::value>::call(*this, vec<L, T, Q>(v.x)));
}
template<typename Tx>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> & operator+=(vec<L, Tx, Q> v)
inline GLM_CONSTEXPR vec<L, T, Q> & operator+=(vec<L, Tx, Q> v)
{
return (*this = detail::compute_vec_add<L, T, Q, detail::is_aligned<Q>::value>::call(*this, vec<L T, Q>(v)));
return (*this = detail::compute_vec_add<L, T, Q, detail::is_aligned<Q>::value>::call(*this, vec<L, T, Q>(v)));
}
GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> & operator-=(arithmetic auto scalar)
inline GLM_CONSTEXPR vec<L, T, Q> & operator-=(arithmetic auto scalar)
{
return (*this = detail::compute_vec_sub<L, T, Q, detail::is_aligned<Q>::value>::call(*this, vec<L, T, Q>(scalar)));
}
template<typename Tx>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> & operator-=(vec<1, Tx, Q> v)
inline GLM_CONSTEXPR vec<L, T, Q> & operator-=(vec<1, Tx, Q> v)
{
return (*this = detail::compute_vec_sub<L, T, Q, detail::is_aligned<Q>::value>::call(*this, vec<L, T, Q>(v.x)));
}
template<typename Tx>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> & operator-=(vec<L, Tx, Q> v)
inline GLM_CONSTEXPR vec<L, T, Q> & operator-=(vec<L, Tx, Q> v)
{
return (*this = detail::compute_vec_sub<L, T, Q, detail::is_aligned<Q>::value>::call(*this, vec<L, T, Q>(v)));
}
GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> & operator*=(arithmetic auto scalar)
inline GLM_CONSTEXPR vec<L, T, Q> & operator*=(arithmetic auto scalar)
{
return (*this = detail::compute_vec_mul<L,T, Q, detail::is_aligned<Q>::value>::call(*this, vec<L, T, Q>(scalar)));
}
template<typename Tx>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> & operator*=(vec<1, Tx, Q> v)
inline GLM_CONSTEXPR vec<L, T, Q> & operator*=(vec<1, Tx, Q> v)
{
return (*this = detail::compute_vec_mul<L,T, Q, detail::is_aligned<Q>::value>::call(*this, vec<L, T, Q>(v.x)));
}
template<typename Tx>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> & operator*=(vec<L, Tx, Q> v)
inline GLM_CONSTEXPR vec<L, T, Q> & operator*=(vec<L, Tx, Q> v)
{
return (*this = detail::compute_vec_mul<L,T, Q, detail::is_aligned<Q>::value>::call(*this, vec<L, T, Q>(v)));
}
GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> & operator/=(arithmetic auto scalar)
inline GLM_CONSTEXPR vec<L, T, Q> & operator/=(arithmetic auto scalar)
{
return (*this = detail::compute_vec_div<L, T, Q, detail::is_aligned<Q>::value>::call(*this, vec<L, T, Q>(scalar)));
}
template<typename Tx>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> & operator/=(vec<1, Tx, Q> v)
inline GLM_CONSTEXPR vec<L, T, Q> & operator/=(vec<1, Tx, Q> v)
{
return (*this = detail::compute_vec_div<L, T, Q, detail::is_aligned<Q>::value>::call(*this, vec<L, T, Q>(v.x)));
}
template<typename Tx>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> & operator/=(vec<L, Tx, Q> v)
inline GLM_CONSTEXPR vec<L, T, Q> & operator/=(vec<L, Tx, Q> v)
{
return (*this = detail::compute_vec_div<L, T, Q, detail::is_aligned<Q>::value>::call(*this, vec<L, T, Q>(v)));
}
// -- Increment and decrement operators --
GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> & operator++()
inline GLM_CONSTEXPR vec<L, T, Q> & operator++()
{
++this->x;
++this->y;
@ -374,7 +375,7 @@ namespace glm
return *this;
}
GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> & operator--()
inline GLM_CONSTEXPR vec<L, T, Q> & operator--()
{
--this->x;
--this->y;
@ -383,14 +384,14 @@ namespace glm
return *this;
}
GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> operator++(int)
inline GLM_CONSTEXPR vec<L, T, Q> operator++(int)
{
vec<L, T, Q> Result(*this);
++*this;
return Result;
}
GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> operator--(int)
inline GLM_CONSTEXPR vec<L, T, Q> operator--(int)
{
vec<L, T, Q> Result(*this);
--*this;
@ -399,227 +400,227 @@ namespace glm
// -- Unary bit operators --
GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> & operator%=(arithmetic auto scalar)
inline GLM_CONSTEXPR vec<L, T, Q> & operator%=(arithmetic auto scalar)
{
return (*this = detail::compute_vec_mod<L, T, Q, detail::is_aligned<Q>::value>::call(*this, vec<L, T, Q>(scalar)));
}
template<typename Tx>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> & operator%=(vec<1, Tx, Q> v)
inline GLM_CONSTEXPR vec<L, T, Q> & operator%=(vec<1, Tx, Q> v)
{
return (*this = detail::compute_vec_mod<L, T, Q, detail::is_aligned<Q>::value>::call(*this, vec<L, T, Q>(v)));
}
template<typename Tx>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> & operator%=(vec<L, Tx, Q> v)
inline GLM_CONSTEXPR vec<L, T, Q> & operator%=(vec<L, Tx, Q> v)
{
return (*this = detail::compute_vec_mod<L, T, Q, detail::is_aligned<Q>::value>::call(*this, vec<L, T, Q>(v)));
}
GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> & operator&=(arithmetic auto scalar)
inline GLM_CONSTEXPR vec<L, T, Q> & operator&=(arithmetic auto scalar)
{
return (*this = detail::compute_vec_and<L, T, Q, detail::is_int<T>::value, sizeof(T) * 8, detail::is_aligned<Q>::value>::call(*this, vec<L, T, Q>(scalar)));
}
template<typename Tx>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> & operator&=(vec<1, Tx, Q> v)
inline GLM_CONSTEXPR vec<L, T, Q> & operator&=(vec<1, Tx, Q> v)
{
return (*this = detail::compute_vec_and<L, T, Q, detail::is_int<T>::value, sizeof(T) * 8, detail::is_aligned<Q>::value>::call(*this, vec<L, T, Q>(v)));
}
template<typename Tx>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> & operator&=(vec<L, Tx, Q> v)
inline GLM_CONSTEXPR vec<L, T, Q> & operator&=(vec<L, Tx, Q> v)
{
return (*this = detail::compute_vec_and<L, T, Q, detail::is_int<T>::value, sizeof(T) * 8, detail::is_aligned<Q>::value>::call(*this, vec<L, T, Q>(v)));
}
GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> & operator|=(arithmetic auto scalar)
inline GLM_CONSTEXPR vec<L, T, Q> & operator|=(arithmetic auto scalar)
{
return (*this = detail::compute_vec_or<L, T, Q, detail::is_int<T>::value, sizeof(T) * 8, detail::is_aligned<Q>::value>::call(*this, vec<L, T, Q>(scalar)));
}
template<typename Tx>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> & operator|=(vec<1, Tx, Q> const& v)
inline GLM_CONSTEXPR vec<L, T, Q> & operator|=(vec<1, Tx, Q> const& v)
{
return (*this = detail::compute_vec_or<L, T, Q, detail::is_int<T>::value, sizeof(T) * 8, detail::is_aligned<Q>::value>::call(*this, vec<L, T, Q>(v)));
}
template<typename Tx>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> & operator|=(vec<L, Tx, Q> const& v)
inline GLM_CONSTEXPR vec<L, T, Q> & operator|=(vec<L, Tx, Q> const& v)
{
return (*this = detail::compute_vec_or<L, T, Q, detail::is_int<T>::value, sizeof(T) * 8, detail::is_aligned<Q>::value>::call(*this, vec<L, T, Q>(v)));
}
GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> & operator^=(arithmetic auto scalar)
inline GLM_CONSTEXPR vec<L, T, Q> & operator^=(arithmetic auto scalar)
{
return (*this = detail::compute_vec_xor<L, T, Q, detail::is_int<T>::value, sizeof(T) * 8, detail::is_aligned<Q>::value>::call(*this, vec<L, T, Q>(scalar)));
}
template<typename Tx>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> & operator^=(vec<1, Tx, Q> const& v)
inline GLM_CONSTEXPR vec<L, T, Q> & operator^=(vec<1, Tx, Q> const& v)
{
return (*this = detail::compute_vec_xor<L, T, Q, detail::is_int<T>::value, sizeof(T) * 8, detail::is_aligned<Q>::value>::call(*this, vec<L, T, Q>(v)));
}
template<typename Tx>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> & operator^=(vec<L, Tx, Q> const& v)
inline GLM_CONSTEXPR vec<L, T, Q> & operator^=(vec<L, Tx, Q> const& v)
{
return (*this = detail::compute_vec_xor<L, T, Q, detail::is_int<T>::value, sizeof(T) * 8, detail::is_aligned<Q>::value>::call(*this, vec<L, T, Q>(v)));
}
GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> & operator<<=(arithmetic auto scalar)
inline GLM_CONSTEXPR vec<L, T, Q> & operator<<=(arithmetic auto scalar)
{
return (*this = detail::compute_vec_shift_left<L, T, Q, detail::is_int<T>::value, sizeof(T) * 8, detail::is_aligned<Q>::value>::call(*this, vec<L, T, Q>(scalar)));
}
template<typename Tx>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> & operator<<=(vec<1, Tx, Q> const& v)
inline GLM_CONSTEXPR vec<L, T, Q> & operator<<=(vec<1, Tx, Q> const& v)
{
return (*this = detail::compute_vec_shift_left<L, T, Q, detail::is_int<T>::value, sizeof(T) * 8, detail::is_aligned<Q>::value>::call(*this, vec<L, T, Q>(v)));
}
template<typename Tx>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> & operator<<=(vec<L, Tx, Q> const& v)
inline GLM_CONSTEXPR vec<L, T, Q> & operator<<=(vec<L, Tx, Q> const& v)
{
return (*this = detail::compute_vec_shift_left<L, T, Q, detail::is_int<T>::value, sizeof(T) * 8, detail::is_aligned<Q>::value>::call(*this, vec<L, T, Q>(v)));
}
GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> & operator>>=(arithmetic auto scalar)
inline GLM_CONSTEXPR vec<L, T, Q> & operator>>=(arithmetic auto scalar)
{
return (*this = detail::compute_vec_shift_right<L, T, Q, detail::is_int<T>::value, sizeof(T) * 8, detail::is_aligned<Q>::value>::call(*this, vec<L, T, Q>(scalar)));
}
template<typename Tx>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> & operator>>=(vec<1, Tx, Q> const& v)
inline GLM_CONSTEXPR vec<L, T, Q> & operator>>=(vec<1, Tx, Q> const& v)
{
return (*this = detail::compute_vec_shift_right<L, T, Q, detail::is_int<T>::value, sizeof(T) * 8, detail::is_aligned<Q>::value>::call(*this, vec<L, T, Q>(v)));
}
template<typename Tx>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> & operator>>=(vec<L, Tx, Q> const& v)
inline GLM_CONSTEXPR vec<L, T, Q> & operator>>=(vec<L, Tx, Q> const& v)
{
return (*this = detail::compute_vec_shift_right<L, T, Q, detail::is_int<T>::value, sizeof(T) * 8, detail::is_aligned<Q>::value>::call(*this, vec<L, T, Q>(v)));
}
// -- Unary constant operators --
GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> operator+()
inline GLM_CONSTEXPR vec<L, T, Q> operator+()
{
return *this;
}
GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> operator-()
inline GLM_CONSTEXPR vec<L, T, Q> operator-()
{
return vec<L, T, Q>(0) -= *this;
}
// -- Binary arithmetic operators --
GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> operator+(T scalar)
inline GLM_CONSTEXPR vec<L, T, Q> operator+(T scalar)
{
return vec<L, T, Q>(*this) += scalar;
}
GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> operator+(vec<1, T, Q> const& v2)
inline GLM_CONSTEXPR vec<L, T, Q> operator+(vec<1, T, Q> const& v2)
{
return vec<L, T, Q>(*this) += v2;
}
friend GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> operator+(T scalar, vec<L, T, Q> const& v)
friend inline GLM_CONSTEXPR vec<L, T, Q> operator+(T scalar, vec<L, T, Q> const& v)
{
return vec<L, T, Q>(v) += scalar;
}
friend GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> operator+(vec<1, T, Q> const& v1, vec<L, T, Q> const& v2)
friend inline GLM_CONSTEXPR vec<L, T, Q> operator+(vec<1, T, Q> const& v1, vec<L, T, Q> const& v2)
{
return vec<L, T, Q>(v2) += v1;
}
GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> operator+(vec<L, T, Q> v2)
inline GLM_CONSTEXPR vec<L, T, Q> operator+(vec<L, T, Q> v2)
{
return vec<L, T, Q>(*this) += v2;
}
GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> operator-(T scalar)
inline GLM_CONSTEXPR vec<L, T, Q> operator-(T scalar)
{
return vec<L, T, Q>(*this) -= scalar;
}
GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> operator-(vec<1, T, Q> const& v2)
inline GLM_CONSTEXPR vec<L, T, Q> operator-(vec<1, T, Q> const& v2)
{
return vec<L, T, Q>(*this) -= v2;
}
friend GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> operator-(T scalar, vec<L, T, Q> const& v)
friend inline GLM_CONSTEXPR vec<L, T, Q> operator-(T scalar, vec<L, T, Q> const& v)
{
return vec<L, T, Q>(scalar) -= v;
}
friend GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> operator-(vec<1, T, Q> const& v1, vec<L, T, Q> const& v2)
friend inline GLM_CONSTEXPR vec<L, T, Q> operator-(vec<1, T, Q> const& v1, vec<L, T, Q> const& v2)
{
return vec<L, T, Q>(v1.x) -= v2;
}
friend GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> operator-(vec<L, T, Q> const& v1, vec<L, T, Q> const& v2)
friend inline GLM_CONSTEXPR vec<L, T, Q> operator-(vec<L, T, Q> const& v1, vec<L, T, Q> const& v2)
{
return vec<L, T, Q>(v1) -= v2;
}
GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> operator*(T scalar)
inline GLM_CONSTEXPR vec<L, T, Q> operator*(T scalar)
{
return vec<L, T, Q>(*this) *= scalar;
}
GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> operator*(vec<1, T, Q> const& v2)
inline GLM_CONSTEXPR vec<L, T, Q> operator*(vec<1, T, Q> const& v2)
{
return vec<L, T, Q>(*this) *= v2;
}
friend GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> operator*(T scalar, vec<L, T, Q> const& v)
friend inline GLM_CONSTEXPR vec<L, T, Q> operator*(T scalar, vec<L, T, Q> const& v)
{
return vec<L, T, Q>(v) *= scalar;
}
friend GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> operator*(vec<1, T, Q> const& v1, vec<L, T, Q> const& v2)
friend inline GLM_CONSTEXPR vec<L, T, Q> operator*(vec<1, T, Q> const& v1, vec<L, T, Q> const& v2)
{
return vec<L, T, Q>(v2) *= v1;
}
friend GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> operator*(vec<L, T, Q> const& v1, vec<L, T, Q> const& v2)
friend inline GLM_CONSTEXPR vec<L, T, Q> operator*(vec<L, T, Q> const& v1, vec<L, T, Q> const& v2)
{
return vec<L, T, Q>(v1) *= v2;
}
GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> operator/(T scalar)
inline GLM_CONSTEXPR vec<L, T, Q> operator/(T scalar)
{
return vec<L, T, Q>(*this) /= scalar;
}
GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> operator/(vec<1, T, Q> const& v2)
inline GLM_CONSTEXPR vec<L, T, Q> operator/(vec<1, T, Q> const& v2)
{
return vec<L, T, Q>(*this) /= v2;
}
friend GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> operator/(T scalar, vec<L, T, Q> const& v)
friend inline GLM_CONSTEXPR vec<L, T, Q> operator/(T scalar, vec<L, T, Q> const& v)
{
return vec<L, T, Q>(scalar) /= v;
}
friend GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> operator/(vec<1, T, Q> const& v1, vec<L, T, Q> const& v2)
friend inline GLM_CONSTEXPR vec<L, T, Q> operator/(vec<1, T, Q> const& v1, vec<L, T, Q> const& v2)
{
return vec<L, T, Q>(v1.x) /= v2;
}
friend GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> operator/(vec<L, T, Q> const& v1, vec<L, T, Q> const& v2)
friend inline GLM_CONSTEXPR vec<L, T, Q> operator/(vec<L, T, Q> const& v1, vec<L, T, Q> const& v2)
{
return vec<L, T, Q>(v1) /= v2;
}
@ -627,212 +628,213 @@ namespace glm
// -- Binary bit operators --
friend GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> operator%(vec<L, T, Q> const& v, T scalar)
friend inline GLM_CONSTEXPR vec<L, T, Q> operator%(vec<L, T, Q> const& v, T scalar)
{
return vec<L, T, Q>(v) %= scalar;
}
friend GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> operator%(vec<L, T, Q> const& v1, vec<1, T, Q> const& v2)
friend inline GLM_CONSTEXPR vec<L, T, Q> operator%(vec<L, T, Q> const& v1, vec<1, T, Q> const& v2)
{
return vec<L, T, Q>(v1) %= v2.x;
}
friend GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> operator%(T scalar, vec<L, T, Q> const& v)
friend inline GLM_CONSTEXPR vec<L, T, Q> operator%(T scalar, vec<L, T, Q> const& v)
{
return vec<L, T, Q>(scalar) %= v;
}
friend GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> operator%(vec<1, T, Q> const& scalar, vec<L, T, Q> const& v)
friend inline GLM_CONSTEXPR vec<L, T, Q> operator%(vec<1, T, Q> const& scalar, vec<L, T, Q> const& v)
{
return vec<L, T, Q>(scalar.x) %= v;
}
friend GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> operator%(vec<L, T, Q> const& v1, vec<L, T, Q> const& v2)
friend inline GLM_CONSTEXPR vec<L, T, Q> operator%(vec<L, T, Q> const& v1, vec<L, T, Q> const& v2)
{
return vec<L, T, Q>(v1) %= v2;
}
friend GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> operator&(vec<L, T, Q> const& v, T scalar)
friend inline GLM_CONSTEXPR vec<L, T, Q> operator&(vec<L, T, Q> const& v, T scalar)
{
return vec<L, T, Q>(v) &= scalar;
}
friend GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> operator&(vec<L, T, Q> const& v, vec<1, T, Q> const& scalar)
friend inline GLM_CONSTEXPR vec<L, T, Q> operator&(vec<L, T, Q> const& v, vec<1, T, Q> const& scalar)
{
return vec<L, T, Q>(v) &= scalar;
}
friend GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> operator&(T scalar, vec<L, T, Q> const& v)
friend inline GLM_CONSTEXPR vec<L, T, Q> operator&(T scalar, vec<L, T, Q> const& v)
{
return vec<L, T, Q>(scalar) &= v;
}
friend GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> operator&(vec<1, T, Q> const& v1, vec<L, T, Q> const& v2)
friend inline GLM_CONSTEXPR vec<L, T, Q> operator&(vec<1, T, Q> const& v1, vec<L, T, Q> const& v2)
{
return vec<L, T, Q>(v1.x) &= v2;
}
friend GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> operator&(vec<L, T, Q> const& v1, vec<L, T, Q> const& v2)
friend inline GLM_CONSTEXPR vec<L, T, Q> operator&(vec<L, T, Q> const& v1, vec<L, T, Q> const& v2)
{
return vec<L, T, Q>(v1) &= v2;
}
friend GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> operator|(vec<L, T, Q> const& v, T scalar)
friend inline GLM_CONSTEXPR vec<L, T, Q> operator|(vec<L, T, Q> const& v, T scalar)
{
return vec<L, T, Q>(v) |= scalar;
}
friend GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> operator|(vec<L, T, Q> const& v1, vec<1, T, Q> const& v2)
friend inline GLM_CONSTEXPR vec<L, T, Q> operator|(vec<L, T, Q> const& v1, vec<1, T, Q> const& v2)
{
return vec<L, T, Q>(v1) |= v2.x;
}
friend GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> operator|(T scalar, vec<L, T, Q> const& v)
friend inline GLM_CONSTEXPR vec<L, T, Q> operator|(T scalar, vec<L, T, Q> const& v)
{
return vec<L, T, Q>(scalar) |= v;
}
friend GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> operator|(vec<1, T, Q> const& v1, vec<L, T, Q> const& v2)
friend inline GLM_CONSTEXPR vec<L, T, Q> operator|(vec<1, T, Q> const& v1, vec<L, T, Q> const& v2)
{
return vec<L, T, Q>(v1.x) |= v2;
}
friend GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> operator|(vec<L, T, Q> const& v1, vec<L, T, Q> const& v2)
friend inline GLM_CONSTEXPR vec<L, T, Q> operator|(vec<L, T, Q> const& v1, vec<L, T, Q> const& v2)
{
return vec<L, T, Q>(v1) |= v2;
}
friend GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> operator^(vec<L, T, Q> const& v, T scalar)
friend inline GLM_CONSTEXPR vec<L, T, Q> operator^(vec<L, T, Q> const& v, T scalar)
{
return vec<L, T, Q>(v) ^= scalar;
}
friend GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> operator^(vec<L, T, Q> const& v1, vec<1, T, Q> const& v2)
friend inline GLM_CONSTEXPR vec<L, T, Q> operator^(vec<L, T, Q> const& v1, vec<1, T, Q> const& v2)
{
return vec<L, T, Q>(v1) ^= v2.x;
}
friend GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> operator^(T scalar, vec<L, T, Q> const& v)
friend inline GLM_CONSTEXPR vec<L, T, Q> operator^(T scalar, vec<L, T, Q> const& v)
{
return vec<L, T, Q>(scalar) ^= v;
}
friend GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> operator^(vec<1, T, Q> const& v1, vec<L, T, Q> const& v2)
friend inline GLM_CONSTEXPR vec<L, T, Q> operator^(vec<1, T, Q> const& v1, vec<L, T, Q> const& v2)
{
return vec<L, T, Q>(v1.x) ^= v2;
}
friend GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> operator^(vec<L, T, Q> const& v1, vec<L, T, Q> const& v2)
friend inline GLM_CONSTEXPR vec<L, T, Q> operator^(vec<L, T, Q> const& v1, vec<L, T, Q> const& v2)
{
return vec<L, T, Q>(v1) ^= v2;
}
friend GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> operator<<(vec<L, T, Q> const& v, T scalar)
friend inline GLM_CONSTEXPR vec<L, T, Q> operator<<(vec<L, T, Q> const& v, T scalar)
{
return vec<L, T, Q>(v) <<= scalar;
}
friend GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> operator<<(vec<L, T, Q> const& v1, vec<1, T, Q> const& v2)
friend inline GLM_CONSTEXPR vec<L, T, Q> operator<<(vec<L, T, Q> const& v1, vec<1, T, Q> const& v2)
{
return vec<L, T, Q>(v1) <<= v2.x;
}
friend GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> operator<<(T scalar, vec<L, T, Q> const& v)
friend inline GLM_CONSTEXPR vec<L, T, Q> operator<<(T scalar, vec<L, T, Q> const& v)
{
return vec<L, T, Q>(scalar) <<= v;
}
friend GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> operator<<(vec<1, T, Q> const& v1, vec<L, T, Q> const& v2)
friend inline GLM_CONSTEXPR vec<L, T, Q> operator<<(vec<1, T, Q> const& v1, vec<L, T, Q> const& v2)
{
return vec<L, T, Q>(v1.x) <<= v2;
}
friend GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> operator<<(vec<L, T, Q> const& v1, vec<L, T, Q> const& v2)
friend inline GLM_CONSTEXPR vec<L, T, Q> operator<<(vec<L, T, Q> const& v1, vec<L, T, Q> const& v2)
{
return vec<L, T, Q>(v1) <<= v2;
}
friend GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> operator>>(vec<L, T, Q> const& v, T scalar)
friend inline GLM_CONSTEXPR vec<L, T, Q> operator>>(vec<L, T, Q> const& v, T scalar)
{
return vec<L, T, Q>(v) >>= scalar;
}
friend GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> operator>>(vec<L, T, Q> const& v1, vec<1, T, Q> const& v2)
friend inline GLM_CONSTEXPR vec<L, T, Q> operator>>(vec<L, T, Q> const& v1, vec<1, T, Q> const& v2)
{
return vec<L, T, Q>(v1) >>= v2.x;
}
friend GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> operator>>(T scalar, vec<L, T, Q> const& v)
friend inline GLM_CONSTEXPR vec<L, T, Q> operator>>(T scalar, vec<L, T, Q> const& v)
{
return vec<L, T, Q>(scalar) >>= v;
}
friend GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> operator>>(vec<1, T, Q> const& v1, vec<L, T, Q> const& v2)
friend inline GLM_CONSTEXPR vec<L, T, Q> operator>>(vec<1, T, Q> const& v1, vec<L, T, Q> const& v2)
{
return vec<L, T, Q>(v1.x) >>= v2;
}
friend GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> operator>>(vec<L, T, Q> const& v1, vec<L, T, Q> const& v2)
friend inline GLM_CONSTEXPR vec<L, T, Q> operator>>(vec<L, T, Q> const& v1, vec<L, T, Q> const& v2)
{
return vec<L, T, Q>(v1) >>= v2;
}
friend GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, Q> operator~(vec<L, T, Q> const& v)
friend inline GLM_CONSTEXPR vec<L, T, Q> operator~(vec<L, T, Q> const& v)
{
return detail::compute_vec_bitwise_not<4, T, Q, detail::is_int<T>::value, sizeof(T) * 8, detail::is_aligned<Q>::value>::call(v);
}
// -- Boolean operators --
friend GLM_FUNC_QUALIFIER GLM_CONSTEXPR bool operator==(vec<L, T, Q> const& v1, vec<L, T, Q> const& v2)
friend inline GLM_CONSTEXPR bool operator==(vec<L, T, Q> const& v1, vec<L, T, Q> const& v2)
{
return detail::compute_vec_equal<4, T, Q, detail::is_int<T>::value, sizeof(T) * 8, detail::is_aligned<Q>::value>::call(v1, v2);
}
friend GLM_FUNC_QUALIFIER GLM_CONSTEXPR bool operator!=(vec<L, T, Q> const& v1, vec<L, T, Q> const& v2)
friend inline GLM_CONSTEXPR bool operator!=(vec<L, T, Q> const& v1, vec<L, T, Q> const& v2)
{
return detail::compute_vec_nequal<4, T, Q, detail::is_int<T>::value, sizeof(T) * 8, detail::is_aligned<Q>::value>::call(v1, v2);
}
friend GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, bool, Q> operator&&(vec<L, bool, Q> const& v1, vec<L, bool, Q> const& v2)
{
return vec<L, bool, Q>(v1.x && v2.x, v1.y && v2.y, v1.z && v2.z, v1.w && v2.w);
}
friend GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, bool, Q> operator||(vec<L, bool, Q> const& v1, vec<L, bool, Q> const& v2)
{
return vec<L, bool, Q>(v1.x || v2.x, v1.y || v2.y, v1.z || v2.z, v1.w || v2.w);
}
};
template <length_t Lx, typename Tx, qualifier Qx> requires (std::is_same_v<Tx, bool>)
inline GLM_CONSTEXPR vec<Lx, bool, Qx> operator&&(vec<Lx, Tx, Qx> const& v1, vec<Lx, Tx, Qx> const& v2)
{
return vec<Lx, bool, Qx>(v1.x && v2.x, v1.y && v2.y, v1.z && v2.z, v1.w && v2.w);
}
template <length_t Lx, typename Tx, qualifier Qx> requires (std::is_same_v<Tx, bool>)
inline GLM_CONSTEXPR vec<Lx, bool, Qx> operator||(vec<Lx, bool, Qx> const& v1, vec<Lx, bool, Qx> const& v2)
{
return vec<Lx, bool, Qx>(v1.x || v2.x, v1.y || v2.y, v1.z || v2.z, v1.w || v2.w);
}
}

View File

@ -1,6 +1,6 @@
/// @ref core
/// @file glm/detail/type_vec1.hpp
#if GLM_SIMD_CONSTEXPR == 0
#pragma once
#include "qualifier.hpp"
@ -306,3 +306,4 @@ namespace glm
#ifndef GLM_EXTERNAL_TEMPLATE
#include "type_vec1.inl"
#endif//GLM_EXTERNAL_TEMPLATE
#endif

View File

@ -1,6 +1,6 @@
/// @ref core
/// @file glm/detail/type_vec2.hpp
#if GLM_SIMD_CONSTEXPR == 0
#pragma once
#include "qualifier.hpp"
@ -404,3 +404,4 @@ namespace glm
#ifndef GLM_EXTERNAL_TEMPLATE
#include "type_vec2.inl"
#endif//GLM_EXTERNAL_TEMPLATE
#endif

View File

@ -1,6 +1,6 @@
/// @ref core
/// @file glm/detail/type_vec3.hpp
#if GLM_SIMD_CONSTEXPR == 0
#pragma once
#include "qualifier.hpp"
@ -445,3 +445,5 @@ namespace glm
#ifndef GLM_EXTERNAL_TEMPLATE
#include "type_vec3.inl"
#endif//GLM_EXTERNAL_TEMPLATE
#endif

View File

@ -1,6 +1,6 @@
/// @ref core
/// @file glm/detail/type_vec4.hpp
#if GLM_SIMD_CONSTEXPR == 0
#pragma once
#include "qualifier.hpp"
@ -512,3 +512,5 @@ namespace glm
#ifndef GLM_EXTERNAL_TEMPLATE
#include "type_vec4.inl"
#endif//GLM_EXTERNAL_TEMPLATE
#endif

View File

@ -1,5 +1,5 @@
/// @ref core
#if GLM_SIMD_CONSTEXPR == 0
#include "compute_vector_relational.hpp"
#include "compute_vector_decl.hpp"
@ -1128,3 +1128,5 @@ namespace glm {
}
#endif
#endif

View File

@ -105,6 +105,10 @@
#define GLM_SIMD_CONSTEXPR 0
#endif
#if GLM_SIMD_CONSTEXPR == 1
# define GLM_FORCE_INTRINSICS 1
#endif
#include "detail/_fixes.hpp"
#include "detail/setup.hpp"

View File

@ -15,9 +15,14 @@
// Dependencies
#include "detail/qualifier.hpp"
#include "detail/setup.hpp"
#include "vec2.hpp"
#include "vec3.hpp"
#include "vec4.hpp"
#if GLM_SIMD_CONSTEXPR == 0
# include "vec2.hpp"
# include "vec3.hpp"
# include "vec4.hpp"
#else
# include"simd_constexpr/vec.hpp"
#endif
#include "mat2x2.hpp"
#include "mat2x3.hpp"
#include "mat2x4.hpp"

View File

@ -24,4 +24,4 @@ namespace glm
typedef vec<3, bool, defaultp> bvec3;
typedef vec<4, bool, defaultp> bvec4;
}
#include "../detail/simd_constexpr/type_vec.hpp"
#include "../detail/simd_constexpr/vec.hpp"