Bug fixes.

This commit is contained in:
scorpioblood 2024-06-12 20:26:17 +02:00
parent 64225c5830
commit 69be245e29
12 changed files with 801 additions and 1739 deletions

View File

@ -90,7 +90,7 @@ namespace Phanes::Core::Math::Detail
v1.w = comp[3];
}
static constexpr void map(Phanes::Core::Math::TIntVector4<int, true>& r, const Phanes::Core::Math::TIntVector2<int, true>& v1, const Phanes::Core::Math::TIntVector2<int, true>& v2)
static constexpr void map(Phanes::Core::Math::TIntVector4<int, false>& r, const Phanes::Core::Math::TIntVector2<int, false>& v1, const Phanes::Core::Math::TIntVector2<int, false>& v2)
{
r.x = v1.x;
r.y = v1.y;

View File

@ -3,6 +3,10 @@
// --- Vectors ------------------------
#include "Core/public/Math/Vector2.hpp" // <-- Includes Vector3/4 automatically
#include "Core/public/Math/Vector3.hpp" // <-- Includes Vector3/4 automatically
#include "Core/public/Math/Vector4.hpp" // <-- Includes Vector3/4 automatically
#include "Core/public/Math/IntVector2.hpp"
#include "Core/public/Math/IntVector3.hpp"
#include "Core/public/Math/IntVector4.hpp"

View File

@ -9,181 +9,181 @@
namespace Phanes::Core::Math
{
template<IntType T, bool A>
TIntVector2<T, A>::TIntVector2(const TIntVector2<T, A>& v)
template<IntType T, bool S>
TIntVector2<T, S>::TIntVector2(const TIntVector2<T, S>& v)
{
Detail::construct_ivec2<T, SIMD::use_simd<T, 2, A>::value>::map(*this, v);
Detail::construct_ivec2<T, S>::map(*this, v);
}
template<IntType T, bool A>
TIntVector2<T, A>::TIntVector2(const T _x, const T _y)
template<IntType T, bool S>
TIntVector2<T, S>::TIntVector2(const T _x, const T _y)
{
Detail::construct_ivec2<T, SIMD::use_simd<T, 2, A>::value>::map(*this, _x, _y);
Detail::construct_ivec2<T, S>::map(*this, _x, _y);
}
template<IntType T, bool A>
TIntVector2<T, A>::TIntVector2(const T s)
template<IntType T, bool S>
TIntVector2<T, S>::TIntVector2(const T s)
{
Detail::construct_ivec2<T, SIMD::use_simd<T, 2, A>::value>::map(*this, s);
Detail::construct_ivec2<T, S>::map(*this, s);
}
template<IntType T, bool A>
TIntVector2<T, A>::TIntVector2(const T* comp)
template<IntType T, bool S>
TIntVector2<T, S>::TIntVector2(const T* comp)
{
Detail::construct_ivec2<T, SIMD::use_simd<T, 2, A>::value>::map(*this, comp);
Detail::construct_ivec2<T, S>::map(*this, comp);
}
template<IntType T, bool A>
TIntVector2<T, A> operator+=(TIntVector2<T, A>& v1, const TIntVector2<T, A>& v2)
template<IntType T, bool S>
TIntVector2<T, S> operator+=(TIntVector2<T, S>& v1, const TIntVector2<T, S>& v2)
{
Detail::compute_ivec2_add<T, SIMD::use_simd<T, 2, A>::value>::map(v1, v1, v2);
Detail::compute_ivec2_add<T, S>::map(v1, v1, v2);
return v1;
}
template<IntType T, bool A>
TIntVector2<T, A> operator+=(TIntVector2<T, A>& v1, T s)
template<IntType T, bool S>
TIntVector2<T, S> operator+=(TIntVector2<T, S>& v1, T s)
{
Detail::compute_ivec2_add<T, SIMD::use_simd<T, 2, A>::value>::map(v1, v1, s);
Detail::compute_ivec2_add<T, S>::map(v1, v1, s);
return v1;
}
template<IntType T, bool A>
TIntVector2<T, A> operator-=(TIntVector2<T, A>& v1, const TIntVector2<T, A>& v2)
template<IntType T, bool S>
TIntVector2<T, S> operator-=(TIntVector2<T, S>& v1, const TIntVector2<T, S>& v2)
{
Detail::compute_ivec2_sub<T, SIMD::use_simd<T, 2, A>::value>::map(v1, v1, v2);
Detail::compute_ivec2_sub<T, S>::map(v1, v1, v2);
return v1;
}
template<IntType T, bool A>
TIntVector2<T, A> operator-=(TIntVector2<T, A>& v1, T s)
template<IntType T, bool S>
TIntVector2<T, S> operator-=(TIntVector2<T, S>& v1, T s)
{
Detail::compute_ivec2_sub<T, SIMD::use_simd<T, 2, A>::value>::map(v1, v1, s);
Detail::compute_ivec2_sub<T, S>::map(v1, v1, s);
return v1;
}
template<IntType T, bool A>
TIntVector2<T, A> operator*=(TIntVector2<T, A>& v1, const TIntVector2<T, A>& v2)
template<IntType T, bool S>
TIntVector2<T, S> operator*=(TIntVector2<T, S>& v1, const TIntVector2<T, S>& v2)
{
Detail::compute_ivec2_mul<T, SIMD::use_simd<T, 2, A>::value>::map(v1, v1, v2);
Detail::compute_ivec2_mul<T, S>::map(v1, v1, v2);
return v1;
}
template<IntType T, bool A>
TIntVector2<T, A> operator*=(TIntVector2<T, A>& v1, T s)
template<IntType T, bool S>
TIntVector2<T, S> operator*=(TIntVector2<T, S>& v1, T s)
{
Detail::compute_ivec2_mul<T, SIMD::use_simd<T, 2, A>::value>::map(v1, v1, s);
Detail::compute_ivec2_mul<T, S>::map(v1, v1, s);
return v1;
}
template<IntType T, bool A>
TIntVector2<T, A> operator/=(TIntVector2<T, A>& v1, const TIntVector2<T, A>& v2)
template<IntType T, bool S>
TIntVector2<T, S> operator/=(TIntVector2<T, S>& v1, const TIntVector2<T, S>& v2)
{
Detail::compute_ivec2_div<T, SIMD::use_simd<T, 2, A>::value>::map(v1, v1, v2);
Detail::compute_ivec2_div<T, S>::map(v1, v1, v2);
return v1;
}
template<IntType T, bool A>
TIntVector2<T, A> operator/=(TIntVector2<T, A>& v1, T s)
template<IntType T, bool S>
TIntVector2<T, S> operator/=(TIntVector2<T, S>& v1, T s)
{
Detail::compute_ivec2_div<T, SIMD::use_simd<T, 2, A>::value>::map(v1, v1, s);
Detail::compute_ivec2_div<T, S>::map(v1, v1, s);
return v1;
}
template<IntType T, bool A>
TIntVector2<T, A> operator%=(TIntVector2<T, A>& v1, const TIntVector2<T, A>& v2)
template<IntType T, bool S>
TIntVector2<T, S> operator%=(TIntVector2<T, S>& v1, const TIntVector2<T, S>& v2)
{
Detail::compute_ivec2_mod<T, SIMD::use_simd<T, 2, A>::value>::map(v1, v1, v2);
Detail::compute_ivec2_mod<T, S>::map(v1, v1, v2);
return v1;
}
template<IntType T, bool A>
TIntVector2<T, A> operator%=(TIntVector2<T, A>& v1, T s)
template<IntType T, bool S>
TIntVector2<T, S> operator%=(TIntVector2<T, S>& v1, T s)
{
Detail::compute_ivec2_mod<T, SIMD::use_simd<T, 2, A>::value>::map(v1, v1, s);
Detail::compute_ivec2_mod<T, S>::map(v1, v1, s);
return v1;
}
template<IntType T, bool A>
TIntVector2<T, A> operator+(TIntVector2<T, A>& v1, const TIntVector2<T, A>& v2)
template<IntType T, bool S>
TIntVector2<T, S> operator+(TIntVector2<T, S>& v1, const TIntVector2<T, S>& v2)
{
TIntVector2<T, A> r;
Detail::compute_ivec2_add<T, SIMD::use_simd<T, 2, A>::value>::map(r, v1, v2);
TIntVector2<T, S> r;
Detail::compute_ivec2_add<T, S>::map(r, v1, v2);
return r;
}
template<IntType T, bool A>
TIntVector2<T, A> operator+(TIntVector2<T, A>& v1, T s)
template<IntType T, bool S>
TIntVector2<T, S> operator+(TIntVector2<T, S>& v1, T s)
{
TIntVector2<T, A> r;
Detail::compute_ivec2_add<T, SIMD::use_simd<T, 2, A>::value>::map(r, v1, s);
TIntVector2<T, S> r;
Detail::compute_ivec2_add<T, S>::map(r, v1, s);
return r;
}
template<IntType T, bool A>
TIntVector2<T, A> operator-(TIntVector2<T, A>& v1, const TIntVector2<T, A>& v2)
template<IntType T, bool S>
TIntVector2<T, S> operator-(TIntVector2<T, S>& v1, const TIntVector2<T, S>& v2)
{
TIntVector2<T, A> r;
Detail::compute_ivec2_sub<T, SIMD::use_simd<T, 2, A>::value>::map(r, v1, v2);
TIntVector2<T, S> r;
Detail::compute_ivec2_sub<T, S>::map(r, v1, v2);
return r;
}
template<IntType T, bool A>
TIntVector2<T, A> operator-(TIntVector2<T, A>& v1, T s)
template<IntType T, bool S>
TIntVector2<T, S> operator-(TIntVector2<T, S>& v1, T s)
{
TIntVector2<T, A> r;
Detail::compute_ivec2_sub<T, SIMD::use_simd<T, 2, A>::value>::map(r, v1, s);
TIntVector2<T, S> r;
Detail::compute_ivec2_sub<T, S>::map(r, v1, s);
return r;
}
template<IntType T, bool A>
TIntVector2<T, A> operator*(TIntVector2<T, A>& v1, const TIntVector2<T, A>& v2)
template<IntType T, bool S>
TIntVector2<T, S> operator*(TIntVector2<T, S>& v1, const TIntVector2<T, S>& v2)
{
TIntVector2<T, A> r;
Detail::compute_ivec2_mul<T, SIMD::use_simd<T, 2, A>::value>::map(r, v1, v2);
TIntVector2<T, S> r;
Detail::compute_ivec2_mul<T, S>::map(r, v1, v2);
return r;
}
template<IntType T, bool A>
TIntVector2<T, A> operator*(TIntVector2<T, A>& v1, T s)
template<IntType T, bool S>
TIntVector2<T, S> operator*(TIntVector2<T, S>& v1, T s)
{
TIntVector2<T, A> r;
Detail::compute_ivec2_mul<T, SIMD::use_simd<T, 2, A>::value>::map(r, v1, s);
TIntVector2<T, S> r;
Detail::compute_ivec2_mul<T, S>::map(r, v1, s);
return r;
}
template<IntType T, bool A>
TIntVector2<T, A> operator/(TIntVector2<T, A>& v1, const TIntVector2<T, A>& v2)
template<IntType T, bool S>
TIntVector2<T, S> operator/(TIntVector2<T, S>& v1, const TIntVector2<T, S>& v2)
{
TIntVector2<T, A> r;
Detail::compute_ivec2_div<T, SIMD::use_simd<T, 2, A>::value>::map(r, v1, v2);
TIntVector2<T, S> r;
Detail::compute_ivec2_div<T, S>::map(r, v1, v2);
return r;
}
template<IntType T, bool A>
TIntVector2<T, A> operator/(TIntVector2<T, A>& v1, T s)
template<IntType T, bool S>
TIntVector2<T, S> operator/(TIntVector2<T, S>& v1, T s)
{
TIntVector2<T, A> r;
Detail::compute_ivec2_div<T, SIMD::use_simd<T, 2, A>::value>::map(r, v1, s);
TIntVector2<T, S> r;
Detail::compute_ivec2_div<T, S>::map(r, v1, s);
return r;
}
template<IntType T, bool A>
TIntVector2<T, A> operator%(TIntVector2<T, A>& v1, const TIntVector2<T, A>& v2)
template<IntType T, bool S>
TIntVector2<T, S> operator%(TIntVector2<T, S>& v1, const TIntVector2<T, S>& v2)
{
TIntVector2<T, A> r;
Detail::compute_ivec2_mod<T, SIMD::use_simd<T, 2, A>::value>::map(r, v1, v2);
TIntVector2<T, S> r;
Detail::compute_ivec2_mod<T, S>::map(r, v1, v2);
return r;
}
template<IntType T, bool A>
TIntVector2<T, A> operator%(TIntVector2<T, A>& v1, T s)
template<IntType T, bool S>
TIntVector2<T, S> operator%(TIntVector2<T, S>& v1, T s)
{
TIntVector2<T, A> r;
Detail::compute_ivec2_mod<T, SIMD::use_simd<T, 2, A>::value>::map(r, v1, s);
TIntVector2<T, S> r;
Detail::compute_ivec2_mod<T, S>::map(r, v1, s);
return r;
}
@ -192,163 +192,163 @@ namespace Phanes::Core::Math
// Bitwise operators
template<IntType T, bool A>
TIntVector2<T, A> operator&=(TIntVector2<T, A>& v1, const TIntVector2<T, A>& v2)
template<IntType T, bool S>
TIntVector2<T, S> operator&=(TIntVector2<T, S>& v1, const TIntVector2<T, S>& v2)
{
Detail::compute_ivec2_and<T, SIMD::use_simd<T, 2, A>::value>::map(v1, v1, v2);
Detail::compute_ivec2_and<T, S>::map(v1, v1, v2);
return v1;
}
template<IntType T, bool A>
TIntVector2<T, A> operator&=(TIntVector2<T, A>& v1, T s)
template<IntType T, bool S>
TIntVector2<T, S> operator&=(TIntVector2<T, S>& v1, T s)
{
Detail::compute_ivec2_and<T, SIMD::use_simd<T, 2, A>::value>::map(v1, v1, s);
Detail::compute_ivec2_and<T, S>::map(v1, v1, s);
return v1;
}
template<IntType T, bool A>
TIntVector2<T, A> operator|=(TIntVector2<T, A>& v1, const TIntVector2<T, A>& v2)
template<IntType T, bool S>
TIntVector2<T, S> operator|=(TIntVector2<T, S>& v1, const TIntVector2<T, S>& v2)
{
Detail::compute_ivec2_or<T, SIMD::use_simd<T, 2, A>::value>::map(v1, v1, v2);
Detail::compute_ivec2_or<T, S>::map(v1, v1, v2);
return v1;
}
template<IntType T, bool A>
TIntVector2<T, A> operator|=(TIntVector2<T, A>& v1, T s)
template<IntType T, bool S>
TIntVector2<T, S> operator|=(TIntVector2<T, S>& v1, T s)
{
Detail::compute_ivec2_or<T, SIMD::use_simd<T, 2, A>::value>::map(v1, v1, s);
Detail::compute_ivec2_or<T, S>::map(v1, v1, s);
return v1;
}
template<IntType T, bool A>
TIntVector2<T, A> operator^=(TIntVector2<T, A>& v1, const TIntVector2<T, A>& v2)
template<IntType T, bool S>
TIntVector2<T, S> operator^=(TIntVector2<T, S>& v1, const TIntVector2<T, S>& v2)
{
Detail::compute_ivec2_xor<T, SIMD::use_simd<T, 2, A>::value>::map(v1, v1, v2);
Detail::compute_ivec2_xor<T, S>::map(v1, v1, v2);
return v1;
}
template<IntType T, bool A>
TIntVector2<T, A> operator^=(TIntVector2<T, A>& v1, T s)
template<IntType T, bool S>
TIntVector2<T, S> operator^=(TIntVector2<T, S>& v1, T s)
{
Detail::compute_ivec2_xor<T, SIMD::use_simd<T, 2, A>::value>::map(v1, v1, s);
Detail::compute_ivec2_xor<T, S>::map(v1, v1, s);
return v1;
}
template<IntType T, bool A>
TIntVector2<T, A> operator<<=(TIntVector2<T, A>& v1, const TIntVector2<T, A>& v2)
template<IntType T, bool S>
TIntVector2<T, S> operator<<=(TIntVector2<T, S>& v1, const TIntVector2<T, S>& v2)
{
Detail::compute_ivec2_left_shift<T, SIMD::use_simd<T, 2, A>::value>::map(v1, v1, v2);
Detail::compute_ivec2_left_shift<T, S>::map(v1, v1, v2);
return v1;
}
template<IntType T, bool A>
TIntVector2<T, A> operator<<=(TIntVector2<T, A>& v1, T s)
template<IntType T, bool S>
TIntVector2<T, S> operator<<=(TIntVector2<T, S>& v1, T s)
{
Detail::compute_ivec2_left_shift<T, SIMD::use_simd<T, 2, A>::value>::map(v1, v1, s);
Detail::compute_ivec2_left_shift<T, S>::map(v1, v1, s);
return v1;
}
template<IntType T, bool A>
TIntVector2<T, A> operator>>=(TIntVector2<T, A>& v1, const TIntVector2<T, A>& v2)
template<IntType T, bool S>
TIntVector2<T, S> operator>>=(TIntVector2<T, S>& v1, const TIntVector2<T, S>& v2)
{
Detail::compute_ivec2_right_shift<T, SIMD::use_simd<T, 2, A>::value>::map(v1, v1, v2);
Detail::compute_ivec2_right_shift<T, S>::map(v1, v1, v2);
return v1;
}
template<IntType T, bool A>
TIntVector2<T, A> operator>>=(TIntVector2<T, A>& v1, T s)
template<IntType T, bool S>
TIntVector2<T, S> operator>>=(TIntVector2<T, S>& v1, T s)
{
Detail::compute_ivec2_right_shift<T, SIMD::use_simd<T, 2, A>::value>::map(v1, v1, s);
Detail::compute_ivec2_right_shift<T, S>::map(v1, v1, s);
return v1;
}
template<IntType T, bool A>
TIntVector2<T, A> operator&(TIntVector2<T, A>& v1, const TIntVector2<T, A>& v2)
template<IntType T, bool S>
TIntVector2<T, S> operator&(TIntVector2<T, S>& v1, const TIntVector2<T, S>& v2)
{
TVector2<T, A> r;
Detail::compute_ivec2_and<T, SIMD::use_simd<T, 2, A>::value>::map(r, v1, v2);
TVector2<T, S> r;
Detail::compute_ivec2_and<T, S>::map(r, v1, v2);
return r;
}
template<IntType T, bool A>
TIntVector2<T, A> operator&(TIntVector2<T, A>& v1, T s)
template<IntType T, bool S>
TIntVector2<T, S> operator&(TIntVector2<T, S>& v1, T s)
{
TVector2<T, A> r;
Detail::compute_ivec2_and<T, SIMD::use_simd<T, 2, A>::value>::map(r, v1, s);
TVector2<T, S> r;
Detail::compute_ivec2_and<T, S>::map(r, v1, s);
return r;
}
template<IntType T, bool A>
TIntVector2<T, A> operator|(TIntVector2<T, A>& v1, const TIntVector2<T, A>& v2)
template<IntType T, bool S>
TIntVector2<T, S> operator|(TIntVector2<T, S>& v1, const TIntVector2<T, S>& v2)
{
TVector2<T, A> r;
Detail::compute_ivec2_or<T, SIMD::use_simd<T, 2, A>::value>::map(r, v1, v2);
TVector2<T, S> r;
Detail::compute_ivec2_or<T, S>::map(r, v1, v2);
return r;
}
template<IntType T, bool A>
TIntVector2<T, A> operator|(TIntVector2<T, A>& v1, T s)
template<IntType T, bool S>
TIntVector2<T, S> operator|(TIntVector2<T, S>& v1, T s)
{
TVector2<T, A> r;
Detail::compute_ivec2_or<T, SIMD::use_simd<T, 2, A>::value>::map(r, v1, s);
TVector2<T, S> r;
Detail::compute_ivec2_or<T, S>::map(r, v1, s);
return r;
}
template<IntType T, bool A>
TIntVector2<T, A> operator^(TIntVector2<T, A>& v1, const TIntVector2<T, A>& v2)
template<IntType T, bool S>
TIntVector2<T, S> operator^(TIntVector2<T, S>& v1, const TIntVector2<T, S>& v2)
{
TVector2<T, A> r;
Detail::compute_ivec2_xor<T, SIMD::use_simd<T, 2, A>::value>::map(r, v1, v2);
TVector2<T, S> r;
Detail::compute_ivec2_xor<T, S>::map(r, v1, v2);
return r;
}
template<IntType T, bool A>
TIntVector2<T, A> operator^(TIntVector2<T, A>& v1, T s)
template<IntType T, bool S>
TIntVector2<T, S> operator^(TIntVector2<T, S>& v1, T s)
{
TVector2<T, A> r;
Detail::compute_ivec2_xor<T, SIMD::use_simd<T, 2, A>::value>::map(r, v1, s);
TVector2<T, S> r;
Detail::compute_ivec2_xor<T, S>::map(r, v1, s);
return r;
}
template<IntType T, bool A>
TIntVector2<T, A> operator<<(TIntVector2<T, A>& v1, const TIntVector2<T, A>& v2)
template<IntType T, bool S>
TIntVector2<T, S> operator<<(TIntVector2<T, S>& v1, const TIntVector2<T, S>& v2)
{
TVector2<T, A> r;
Detail::compute_ivec2_left_shift<T, SIMD::use_simd<T, 2, A>::value>::map(r, v1, v2);
TVector2<T, S> r;
Detail::compute_ivec2_left_shift<T, S>::map(r, v1, v2);
return r;
}
template<IntType T, bool A>
TIntVector2<T, A> operator<<(TIntVector2<T, A>& v1, T s)
template<IntType T, bool S>
TIntVector2<T, S> operator<<(TIntVector2<T, S>& v1, T s)
{
TVector2<T, A> r;
Detail::compute_ivec2_left_shift<T, SIMD::use_simd<T, 2, A>::value>::map(r, v1, s);
TVector2<T, S> r;
Detail::compute_ivec2_left_shift<T, S>::map(r, v1, s);
return r;
}
template<IntType T, bool A>
TIntVector2<T, A> operator>>(TIntVector2<T, A>& v1, const TIntVector2<T, A>& v2)
template<IntType T, bool S>
TIntVector2<T, S> operator>>(TIntVector2<T, S>& v1, const TIntVector2<T, S>& v2)
{
TVector2<T, A> r;
Detail::compute_ivec2_right_shift<T, SIMD::use_simd<T, 2, A>::value>::map(r, v1, v2);
TVector2<T, S> r;
Detail::compute_ivec2_right_shift<T, S>::map(r, v1, v2);
return r;
}
template<IntType T, bool A>
TIntVector2<T, A> operator>>(TIntVector2<T, A>& v1, T s)
template<IntType T, bool S>
TIntVector2<T, S> operator>>(TIntVector2<T, S>& v1, T s)
{
TVector2<T, A> r;
Detail::compute_ivec2_right_shift<T, SIMD::use_simd<T, 2, A>::value>::map(r, v1, s);
TVector2<T, S> r;
Detail::compute_ivec2_right_shift<T, S>::map(r, v1, s);
return r;
}
template<IntType T, bool A>
TIntVector2<T, A> operator~(TIntVector2<T, A>& v1)
template<IntType T, bool S>
TIntVector2<T, S> operator~(TIntVector2<T, S>& v1)
{
TVector2<T, A> r;
Detail::compute_ivec2_bnot<T, SIMD::use_simd<T, 2, A>::value>::map(r, v1);
TVector2<T, S> r;
Detail::compute_ivec2_bnot<T, S>::map(r, v1);
return r;
}
@ -356,16 +356,16 @@ namespace Phanes::Core::Math
// Comparision
template<IntType T, bool A>
bool operator==(const TIntVector2<T, A>& v1, const TIntVector2<T, A>& v2)
template<IntType T, bool S>
bool operator==(const TIntVector2<T, S>& v1, const TIntVector2<T, S>& v2)
{
return Detail::compute_ivec2_eq<T, SIMD::use_simd<T, 2, A>::value>::map(v1, v2);
return Detail::compute_ivec2_eq<T, S>::map(v1, v2);
}
template<IntType T, bool A>
bool operator!=(const TIntVector2<T, A>& v1, const TIntVector2<T, A>& v2)
template<IntType T, bool S>
bool operator!=(const TIntVector2<T, S>& v1, const TIntVector2<T, S>& v2)
{
return Detail::compute_ivec2_ieq<T, SIMD::use_simd<T, 2, A>::value>::map(v1, v2);
return Detail::compute_ivec2_ieq<T, S>::map(v1, v2);
}
@ -373,28 +373,28 @@ namespace Phanes::Core::Math
// Inc- / Decrement
template<IntType T, bool A>
TIntVector2<T, A>& operator++(TIntVector2<T, A>& v1)
template<IntType T, bool S>
TIntVector2<T, S>& operator++(TIntVector2<T, S>& v1)
{
Detail::compute_ivec2_inc<T, SIMD::use_simd<T, 2, A>::value>::map(v1);
Detail::compute_ivec2_inc<T, S>::map(v1);
return v1;
}
template<IntType T, bool A>
TIntVector2<T, A>& operator--(TIntVector2<T, A>& v1)
template<IntType T, bool S>
TIntVector2<T, S>& operator--(TIntVector2<T, S>& v1)
{
Detail::compute_ivec2_inc<T, SIMD::use_simd<T, 2, A>::value>::map(v1);
Detail::compute_ivec2_inc<T, S>::map(v1);
return v1;
}
template<IntType T, bool A>
TIntVector2<T, A>& operator++(TIntVector2<T, A>& v1, int)
template<IntType T, bool S>
TIntVector2<T, S>& operator++(TIntVector2<T, S>& v1, int)
{
return ++v1;
}
template<IntType T, bool A>
TIntVector2<T, A>& operator--(TIntVector2<T, A>& v1, int)
template<IntType T, bool S>
TIntVector2<T, S>& operator--(TIntVector2<T, S>& v1, int)
{
return --v1;
}

View File

@ -10,187 +10,187 @@
namespace Phanes::Core::Math
{
template<IntType T, bool A>
TIntVector3<T, A>::TIntVector3(const TIntVector3<T, A>& v)
template<IntType T, bool S>
TIntVector3<T, S>::TIntVector3(const TIntVector3<T, S>& v)
{
Detail::construct_ivec3<T, SIMD::use_simd<T, 3, A>::value>::map(*this, v);
Detail::construct_ivec3<T, S>::map(*this, v);
}
template<IntType T, bool A>
TIntVector3<T, A>::TIntVector3(const T _x, const T _y, const T _z)
template<IntType T, bool S>
TIntVector3<T, S>::TIntVector3(const T _x, const T _y, const T _z)
{
Detail::construct_ivec3<T, SIMD::use_simd<T, 3, A>::value>::map(*this, _x, _y, _z);
Detail::construct_ivec3<T, S>::map(*this, _x, _y, _z);
}
template<IntType T, bool A>
TIntVector3<T, A>::TIntVector3(const T s)
template<IntType T, bool S>
TIntVector3<T, S>::TIntVector3(const T s)
{
Detail::construct_ivec3<T, SIMD::use_simd<T, 3, A>::value>::map(*this, s);
Detail::construct_ivec3<T, S>::map(*this, s);
}
template<IntType T, bool A>
TIntVector3<T, A>::TIntVector3(const T* comp)
template<IntType T, bool S>
TIntVector3<T, S>::TIntVector3(const T* comp)
{
Detail::construct_ivec3<T, SIMD::use_simd<T, 3, A>::value>::map(*this, comp);
Detail::construct_ivec3<T, S>::map(*this, comp);
}
template<IntType T, bool A>
TIntVector3<T, A>::TIntVector3(const TIntVector2<T, A>& v1, const T s)
template<IntType T, bool S>
TIntVector3<T, S>::TIntVector3(const TIntVector2<T, S>& v1, const T s)
{
Detail::construct_ivec3<T, SIMD::use_simd<T, 3, A>::value>::map(*this, v1, s);
Detail::construct_ivec3<T, S>::map(*this, v1, s);
}
template<IntType T, bool A>
TIntVector3<T, A> operator+=(TIntVector3<T, A>& v1, const TIntVector3<T, A>& v2)
template<IntType T, bool S>
TIntVector3<T, S> operator+=(TIntVector3<T, S>& v1, const TIntVector3<T, S>& v2)
{
Detail::compute_ivec3_add<T, SIMD::use_simd<T, 3, A>::value>::map(v1, v1, v2);
Detail::compute_ivec3_add<T, S>::map(v1, v1, v2);
return v1;
}
template<IntType T, bool A>
TIntVector3<T, A> operator+=(TIntVector3<T, A>& v1, T s)
template<IntType T, bool S>
TIntVector3<T, S> operator+=(TIntVector3<T, S>& v1, T s)
{
Detail::compute_ivec3_add<T, SIMD::use_simd<T, 3, A>::value>::map(v1, v1, s);
Detail::compute_ivec3_add<T, S>::map(v1, v1, s);
return v1;
}
template<IntType T, bool A>
TIntVector3<T, A> operator-=(TIntVector3<T, A>& v1, const TIntVector3<T, A>& v2)
template<IntType T, bool S>
TIntVector3<T, S> operator-=(TIntVector3<T, S>& v1, const TIntVector3<T, S>& v2)
{
Detail::compute_ivec3_sub<T, SIMD::use_simd<T, 3, A>::value>::map(v1, v1, v2);
Detail::compute_ivec3_sub<T, S>::map(v1, v1, v2);
return v1;
}
template<IntType T, bool A>
TIntVector3<T, A> operator-=(TIntVector3<T, A>& v1, T s)
template<IntType T, bool S>
TIntVector3<T, S> operator-=(TIntVector3<T, S>& v1, T s)
{
Detail::compute_ivec3_sub<T, SIMD::use_simd<T, 3, A>::value>::map(v1, v1, s);
Detail::compute_ivec3_sub<T, S>::map(v1, v1, s);
return v1;
}
template<IntType T, bool A>
TIntVector3<T, A> operator*=(TIntVector3<T, A>& v1, const TIntVector3<T, A>& v2)
template<IntType T, bool S>
TIntVector3<T, S> operator*=(TIntVector3<T, S>& v1, const TIntVector3<T, S>& v2)
{
Detail::compute_ivec3_mul<T, SIMD::use_simd<T, 3, A>::value>::map(v1, v1, v2);
Detail::compute_ivec3_mul<T, S>::map(v1, v1, v2);
return v1;
}
template<IntType T, bool A>
TIntVector3<T, A> operator*=(TIntVector3<T, A>& v1, T s)
template<IntType T, bool S>
TIntVector3<T, S> operator*=(TIntVector3<T, S>& v1, T s)
{
Detail::compute_ivec3_mul<T, SIMD::use_simd<T, 3, A>::value>::map(v1, v1, s);
Detail::compute_ivec3_mul<T, S>::map(v1, v1, s);
return v1;
}
template<IntType T, bool A>
TIntVector3<T, A> operator/=(TIntVector3<T, A>& v1, const TIntVector3<T, A>& v2)
template<IntType T, bool S>
TIntVector3<T, S> operator/=(TIntVector3<T, S>& v1, const TIntVector3<T, S>& v2)
{
Detail::compute_ivec3_div<T, SIMD::use_simd<T, 3, A>::value>::map(v1, v1, v2);
Detail::compute_ivec3_div<T, S>::map(v1, v1, v2);
return v1;
}
template<IntType T, bool A>
TIntVector3<T, A> operator/=(TIntVector3<T, A>& v1, T s)
template<IntType T, bool S>
TIntVector3<T, S> operator/=(TIntVector3<T, S>& v1, T s)
{
Detail::compute_ivec3_div<T, SIMD::use_simd<T, 3, A>::value>::map(v1, v1, s);
Detail::compute_ivec3_div<T, S>::map(v1, v1, s);
return v1;
}
template<IntType T, bool A>
TIntVector3<T, A> operator%=(TIntVector3<T, A>& v1, const TIntVector3<T, A>& v2)
template<IntType T, bool S>
TIntVector3<T, S> operator%=(TIntVector3<T, S>& v1, const TIntVector3<T, S>& v2)
{
Detail::compute_ivec3_mod<T, SIMD::use_simd<T, 3, A>::value>::map(v1, v1, v2);
Detail::compute_ivec3_mod<T, S>::map(v1, v1, v2);
return v1;
}
template<IntType T, bool A>
TIntVector3<T, A> operator%=(TIntVector3<T, A>& v1, T s)
template<IntType T, bool S>
TIntVector3<T, S> operator%=(TIntVector3<T, S>& v1, T s)
{
Detail::compute_ivec3_mod<T, SIMD::use_simd<T, 3, A>::value>::map(v1, v1, s);
Detail::compute_ivec3_mod<T, S>::map(v1, v1, s);
return v1;
}
template<IntType T, bool A>
TIntVector3<T, A> operator+(TIntVector3<T, A>& v1, const TIntVector3<T, A>& v2)
template<IntType T, bool S>
TIntVector3<T, S> operator+(TIntVector3<T, S>& v1, const TIntVector3<T, S>& v2)
{
TIntVector3<T, A> r;
Detail::compute_ivec3_add<T, SIMD::use_simd<T, 3, A>::value>::map(r, v1, v2);
TIntVector3<T, S> r;
Detail::compute_ivec3_add<T, S>::map(r, v1, v2);
return r;
}
template<IntType T, bool A>
TIntVector3<T, A> operator+(TIntVector3<T, A>& v1, T s)
template<IntType T, bool S>
TIntVector3<T, S> operator+(TIntVector3<T, S>& v1, T s)
{
TIntVector3<T, A> r;
Detail::compute_ivec3_add<T, SIMD::use_simd<T, 3, A>::value>::map(r, v1, s);
TIntVector3<T, S> r;
Detail::compute_ivec3_add<T, S>::map(r, v1, s);
return r;
}
template<IntType T, bool A>
TIntVector3<T, A> operator-(TIntVector3<T, A>& v1, const TIntVector3<T, A>& v2)
template<IntType T, bool S>
TIntVector3<T, S> operator-(TIntVector3<T, S>& v1, const TIntVector3<T, S>& v2)
{
TIntVector3<T, A> r;
Detail::compute_ivec3_sub<T, SIMD::use_simd<T, 3, A>::value>::map(r, v1, v2);
TIntVector3<T, S> r;
Detail::compute_ivec3_sub<T, S>::map(r, v1, v2);
return r;
}
template<IntType T, bool A>
TIntVector3<T, A> operator-(TIntVector3<T, A>& v1, T s)
template<IntType T, bool S>
TIntVector3<T, S> operator-(TIntVector3<T, S>& v1, T s)
{
TIntVector3<T, A> r;
Detail::compute_ivec3_sub<T, SIMD::use_simd<T, 3, A>::value>::map(r, v1, s);
TIntVector3<T, S> r;
Detail::compute_ivec3_sub<T, S>::map(r, v1, s);
return r;
}
template<IntType T, bool A>
TIntVector3<T, A> operator*(TIntVector3<T, A>& v1, const TIntVector3<T, A>& v2)
template<IntType T, bool S>
TIntVector3<T, S> operator*(TIntVector3<T, S>& v1, const TIntVector3<T, S>& v2)
{
TIntVector3<T, A> r;
Detail::compute_ivec3_mul<T, SIMD::use_simd<T, 3, A>::value>::map(r, v1, v2);
TIntVector3<T, S> r;
Detail::compute_ivec3_mul<T, S>::map(r, v1, v2);
return r;
}
template<IntType T, bool A>
TIntVector3<T, A> operator*(TIntVector3<T, A>& v1, T s)
template<IntType T, bool S>
TIntVector3<T, S> operator*(TIntVector3<T, S>& v1, T s)
{
TIntVector3<T, A> r;
Detail::compute_ivec3_mul<T, SIMD::use_simd<T, 3, A>::value>::map(r, v1, s);
TIntVector3<T, S> r;
Detail::compute_ivec3_mul<T, S>::map(r, v1, s);
return r;
}
template<IntType T, bool A>
TIntVector3<T, A> operator/(TIntVector3<T, A>& v1, const TIntVector3<T, A>& v2)
template<IntType T, bool S>
TIntVector3<T, S> operator/(TIntVector3<T, S>& v1, const TIntVector3<T, S>& v2)
{
TIntVector3<T, A> r;
Detail::compute_ivec3_div<T, SIMD::use_simd<T, 3, A>::value>::map(r, v1, v2);
TIntVector3<T, S> r;
Detail::compute_ivec3_div<T, S>::map(r, v1, v2);
return r;
}
template<IntType T, bool A>
TIntVector3<T, A> operator/(TIntVector3<T, A>& v1, T s)
template<IntType T, bool S>
TIntVector3<T, S> operator/(TIntVector3<T, S>& v1, T s)
{
TIntVector3<T, A> r;
Detail::compute_ivec3_div<T, SIMD::use_simd<T, 3, A>::value>::map(r, v1, s);
TIntVector3<T, S> r;
Detail::compute_ivec3_div<T, S>::map(r, v1, s);
return r;
}
template<IntType T, bool A>
TIntVector3<T, A> operator%(TIntVector3<T, A>& v1, const TIntVector3<T, A>& v2)
template<IntType T, bool S>
TIntVector3<T, S> operator%(TIntVector3<T, S>& v1, const TIntVector3<T, S>& v2)
{
TIntVector3<T, A> r;
Detail::compute_ivec3_mod<T, SIMD::use_simd<T, 3, A>::value>::map(r, v1, v2);
TIntVector3<T, S> r;
Detail::compute_ivec3_mod<T, S>::map(r, v1, v2);
return r;
}
template<IntType T, bool A>
TIntVector3<T, A> operator%(TIntVector3<T, A>& v1, T s)
template<IntType T, bool S>
TIntVector3<T, S> operator%(TIntVector3<T, S>& v1, T s)
{
TIntVector3<T, A> r;
Detail::compute_ivec3_mod<T, SIMD::use_simd<T, 3, A>::value>::map(r, v1, s);
TIntVector3<T, S> r;
Detail::compute_ivec3_mod<T, S>::map(r, v1, s);
return r;
}
@ -199,163 +199,163 @@ namespace Phanes::Core::Math
// Bitwise operators
template<IntType T, bool A>
TIntVector3<T, A> operator&=(TIntVector3<T, A>& v1, const TIntVector3<T, A>& v2)
template<IntType T, bool S>
TIntVector3<T, S> operator&=(TIntVector3<T, S>& v1, const TIntVector3<T, S>& v2)
{
Detail::compute_ivec3_and<T, SIMD::use_simd<T, 3, A>::value>::map(v1, v1, v2);
Detail::compute_ivec3_and<T, S>::map(v1, v1, v2);
return v1;
}
template<IntType T, bool A>
TIntVector3<T, A> operator&=(TIntVector3<T, A>& v1, T s)
template<IntType T, bool S>
TIntVector3<T, S> operator&=(TIntVector3<T, S>& v1, T s)
{
Detail::compute_ivec3_and<T, SIMD::use_simd<T, 3, A>::value>::map(v1, v1, s);
Detail::compute_ivec3_and<T, S>::map(v1, v1, s);
return v1;
}
template<IntType T, bool A>
TIntVector3<T, A> operator|=(TIntVector3<T, A>& v1, const TIntVector3<T, A>& v2)
template<IntType T, bool S>
TIntVector3<T, S> operator|=(TIntVector3<T, S>& v1, const TIntVector3<T, S>& v2)
{
Detail::compute_ivec3_or<T, SIMD::use_simd<T, 3, A>::value>::map(v1, v1, v2);
Detail::compute_ivec3_or<T, S>::map(v1, v1, v2);
return v1;
}
template<IntType T, bool A>
TIntVector3<T, A> operator|=(TIntVector3<T, A>& v1, T s)
template<IntType T, bool S>
TIntVector3<T, S> operator|=(TIntVector3<T, S>& v1, T s)
{
Detail::compute_ivec3_or<T, SIMD::use_simd<T, 3, A>::value>::map(v1, v1, s);
Detail::compute_ivec3_or<T, S>::map(v1, v1, s);
return v1;
}
template<IntType T, bool A>
TIntVector3<T, A> operator^=(TIntVector3<T, A>& v1, const TIntVector3<T, A>& v2)
template<IntType T, bool S>
TIntVector3<T, S> operator^=(TIntVector3<T, S>& v1, const TIntVector3<T, S>& v2)
{
Detail::compute_ivec3_xor<T, SIMD::use_simd<T, 3, A>::value>::map(v1, v1, v2);
Detail::compute_ivec3_xor<T, S>::map(v1, v1, v2);
return v1;
}
template<IntType T, bool A>
TIntVector3<T, A> operator^=(TIntVector3<T, A>& v1, T s)
template<IntType T, bool S>
TIntVector3<T, S> operator^=(TIntVector3<T, S>& v1, T s)
{
Detail::compute_ivec3_xor<T, SIMD::use_simd<T, 3, A>::value>::map(v1, v1, s);
Detail::compute_ivec3_xor<T, S>::map(v1, v1, s);
return v1;
}
template<IntType T, bool A>
TIntVector3<T, A> operator<<=(TIntVector3<T, A>& v1, const TIntVector3<T, A>& v2)
template<IntType T, bool S>
TIntVector3<T, S> operator<<=(TIntVector3<T, S>& v1, const TIntVector3<T, S>& v2)
{
Detail::compute_ivec3_left_shift<T, SIMD::use_simd<T, 3, A>::value>::map(v1, v1, v2);
Detail::compute_ivec3_left_shift<T, S>::map(v1, v1, v2);
return v1;
}
template<IntType T, bool A>
TIntVector3<T, A> operator<<=(TIntVector3<T, A>& v1, T s)
template<IntType T, bool S>
TIntVector3<T, S> operator<<=(TIntVector3<T, S>& v1, T s)
{
Detail::compute_ivec3_left_shift<T, SIMD::use_simd<T, 3, A>::value>::map(v1, v1, s);
Detail::compute_ivec3_left_shift<T, S>::map(v1, v1, s);
return v1;
}
template<IntType T, bool A>
TIntVector3<T, A> operator>>=(TIntVector3<T, A>& v1, const TIntVector3<T, A>& v2)
template<IntType T, bool S>
TIntVector3<T, S> operator>>=(TIntVector3<T, S>& v1, const TIntVector3<T, S>& v2)
{
Detail::compute_ivec3_right_shift<T, SIMD::use_simd<T, 3, A>::value>::map(v1, v1, v2);
Detail::compute_ivec3_right_shift<T, S>::map(v1, v1, v2);
return v1;
}
template<IntType T, bool A>
TIntVector3<T, A> operator>>=(TIntVector3<T, A>& v1, T s)
template<IntType T, bool S>
TIntVector3<T, S> operator>>=(TIntVector3<T, S>& v1, T s)
{
Detail::compute_ivec3_right_shift<T, SIMD::use_simd<T, 3, A>::value>::map(v1, v1, s);
Detail::compute_ivec3_right_shift<T, S>::map(v1, v1, s);
return v1;
}
template<IntType T, bool A>
TIntVector3<T, A> operator&(TIntVector3<T, A>& v1, const TIntVector3<T, A>& v2)
template<IntType T, bool S>
TIntVector3<T, S> operator&(TIntVector3<T, S>& v1, const TIntVector3<T, S>& v2)
{
TVector2<T, A> r;
Detail::compute_ivec3_and<T, SIMD::use_simd<T, 3, A>::value>::map(r, v1, v2);
TVector2<T, S> r;
Detail::compute_ivec3_and<T, S>::map(r, v1, v2);
return r;
}
template<IntType T, bool A>
TIntVector3<T, A> operator&(TIntVector3<T, A>& v1, T s)
template<IntType T, bool S>
TIntVector3<T, S> operator&(TIntVector3<T, S>& v1, T s)
{
TVector2<T, A> r;
Detail::compute_ivec3_and<T, SIMD::use_simd<T, 3, A>::value>::map(r, v1, s);
TVector2<T, S> r;
Detail::compute_ivec3_and<T, S>::map(r, v1, s);
return r;
}
template<IntType T, bool A>
TIntVector3<T, A> operator|(TIntVector3<T, A>& v1, const TIntVector3<T, A>& v2)
template<IntType T, bool S>
TIntVector3<T, S> operator|(TIntVector3<T, S>& v1, const TIntVector3<T, S>& v2)
{
TVector2<T, A> r;
Detail::compute_ivec3_or<T, SIMD::use_simd<T, 3, A>::value>::map(r, v1, v2);
TVector2<T, S> r;
Detail::compute_ivec3_or<T, S>::map(r, v1, v2);
return r;
}
template<IntType T, bool A>
TIntVector3<T, A> operator|(TIntVector3<T, A>& v1, T s)
template<IntType T, bool S>
TIntVector3<T, S> operator|(TIntVector3<T, S>& v1, T s)
{
TVector2<T, A> r;
Detail::compute_ivec3_or<T, SIMD::use_simd<T, 3, A>::value>::map(r, v1, s);
TVector2<T, S> r;
Detail::compute_ivec3_or<T, S>::map(r, v1, s);
return r;
}
template<IntType T, bool A>
TIntVector3<T, A> operator^(TIntVector3<T, A>& v1, const TIntVector3<T, A>& v2)
template<IntType T, bool S>
TIntVector3<T, S> operator^(TIntVector3<T, S>& v1, const TIntVector3<T, S>& v2)
{
TVector2<T, A> r;
Detail::compute_ivec3_xor<T, SIMD::use_simd<T, 3, A>::value>::map(r, v1, v2);
TVector2<T, S> r;
Detail::compute_ivec3_xor<T, S>::map(r, v1, v2);
return r;
}
template<IntType T, bool A>
TIntVector3<T, A> operator^(TIntVector3<T, A>& v1, T s)
template<IntType T, bool S>
TIntVector3<T, S> operator^(TIntVector3<T, S>& v1, T s)
{
TVector2<T, A> r;
Detail::compute_ivec3_xor<T, SIMD::use_simd<T, 3, A>::value>::map(r, v1, s);
TVector2<T, S> r;
Detail::compute_ivec3_xor<T, S>::map(r, v1, s);
return r;
}
template<IntType T, bool A>
TIntVector3<T, A> operator<<(TIntVector3<T, A>& v1, const TIntVector3<T, A>& v2)
template<IntType T, bool S>
TIntVector3<T, S> operator<<(TIntVector3<T, S>& v1, const TIntVector3<T, S>& v2)
{
TVector2<T, A> r;
Detail::compute_ivec3_left_shift<T, SIMD::use_simd<T, 3, A>::value>::map(r, v1, v2);
TVector2<T, S> r;
Detail::compute_ivec3_left_shift<T, S>::map(r, v1, v2);
return r;
}
template<IntType T, bool A>
TIntVector3<T, A> operator<<(TIntVector3<T, A>& v1, T s)
template<IntType T, bool S>
TIntVector3<T, S> operator<<(TIntVector3<T, S>& v1, T s)
{
TVector2<T, A> r;
Detail::compute_ivec3_left_shift<T, SIMD::use_simd<T, 3, A>::value>::map(r, v1, s);
TVector2<T, S> r;
Detail::compute_ivec3_left_shift<T, S>::map(r, v1, s);
return r;
}
template<IntType T, bool A>
TIntVector3<T, A> operator>>(TIntVector3<T, A>& v1, const TIntVector3<T, A>& v2)
template<IntType T, bool S>
TIntVector3<T, S> operator>>(TIntVector3<T, S>& v1, const TIntVector3<T, S>& v2)
{
TVector2<T, A> r;
Detail::compute_ivec3_right_shift<T, SIMD::use_simd<T, 3, A>::value>::map(r, v1, v2);
TVector2<T, S> r;
Detail::compute_ivec3_right_shift<T, S>::map(r, v1, v2);
return r;
}
template<IntType T, bool A>
TIntVector3<T, A> operator>>(TIntVector3<T, A>& v1, T s)
template<IntType T, bool S>
TIntVector3<T, S> operator>>(TIntVector3<T, S>& v1, T s)
{
TVector2<T, A> r;
Detail::compute_ivec3_right_shift<T, SIMD::use_simd<T, 3, A>::value>::map(r, v1, s);
TVector2<T, S> r;
Detail::compute_ivec3_right_shift<T, S>::map(r, v1, s);
return r;
}
template<IntType T, bool A>
TIntVector3<T, A> operator~(TIntVector3<T, A>& v1)
template<IntType T, bool S>
TIntVector3<T, S> operator~(TIntVector3<T, S>& v1)
{
TVector2<T, A> r;
Detail::compute_ivec3_bnot<T, SIMD::use_simd<T, 3, A>::value>::map(r, v1);
TVector2<T, S> r;
Detail::compute_ivec3_bnot<T, S>::map(r, v1);
return r;
}
@ -363,16 +363,16 @@ namespace Phanes::Core::Math
// Comparision
template<IntType T, bool A>
bool operator==(const TIntVector3<T, A>& v1, const TIntVector3<T, A>& v2)
template<IntType T, bool S>
bool operator==(const TIntVector3<T, S>& v1, const TIntVector3<T, S>& v2)
{
return Detail::compute_ivec3_eq<T, SIMD::use_simd<T, 3, A>::value>::map(v1, v2);
return Detail::compute_ivec3_eq<T, S>::map(v1, v2);
}
template<IntType T, bool A>
bool operator!=(const TIntVector3<T, A>& v1, const TIntVector3<T, A>& v2)
template<IntType T, bool S>
bool operator!=(const TIntVector3<T, S>& v1, const TIntVector3<T, S>& v2)
{
return Detail::compute_ivec3_ieq<T, SIMD::use_simd<T, 3, A>::value>::map(v1, v2);
return Detail::compute_ivec3_ieq<T, S>::map(v1, v2);
}
@ -380,28 +380,28 @@ namespace Phanes::Core::Math
// Inc- / Decrement
template<IntType T, bool A>
TIntVector3<T, A>& operator++(TIntVector3<T, A>& v1)
template<IntType T, bool S>
TIntVector3<T, S>& operator++(TIntVector3<T, S>& v1)
{
Detail::compute_ivec3_inc<T, SIMD::use_simd<T, 3, A>::value>::map(v1);
Detail::compute_ivec3_inc<T, S>::map(v1);
return v1;
}
template<IntType T, bool A>
TIntVector3<T, A>& operator--(TIntVector3<T, A>& v1)
template<IntType T, bool S>
TIntVector3<T, S>& operator--(TIntVector3<T, S>& v1)
{
Detail::compute_ivec3_inc<T, SIMD::use_simd<T, 3, A>::value>::map(v1);
Detail::compute_ivec3_inc<T, S>::map(v1);
return v1;
}
template<IntType T, bool A>
TIntVector3<T, A>& operator++(TIntVector3<T, A>& v1, int)
template<IntType T, bool S>
TIntVector3<T, S>& operator++(TIntVector3<T, S>& v1, int)
{
return ++v1;
}
template<IntType T, bool A>
TIntVector3<T, A>& operator--(TIntVector3<T, A>& v1, int)
template<IntType T, bool S>
TIntVector3<T, S>& operator--(TIntVector3<T, S>& v1, int)
{
return --v1;
}

View File

@ -7,6 +7,7 @@
#include "Core/public/Math/SIMD/Storage.h"
#include "Core/public/Math/IntVector2.hpp"
#ifndef P_DEBUG
#pragma warning(disable : 4244)

View File

@ -9,187 +9,187 @@
namespace Phanes::Core::Math
{
template<IntType T, bool A>
TIntVector4<T, A>::TIntVector4(const TIntVector4<T, A>& v)
template<IntType T, bool S>
TIntVector4<T, S>::TIntVector4(const TIntVector4<T, S>& v)
{
Detail::construct_ivec4<T, SIMD::use_simd<T, 4, A>::value>::map(*this, v);
Detail::construct_ivec4<T, S>::map(*this, v);
}
template<IntType T, bool A>
TIntVector4<T, A>::TIntVector4(const T _x, const T _y, const T _z, const T _w)
template<IntType T, bool S>
TIntVector4<T, S>::TIntVector4(const T _x, const T _y, const T _z, const T _w)
{
Detail::construct_ivec4<T, SIMD::use_simd<T, 4, A>::value>::map(*this, _x, _y, _z, _w);
Detail::construct_ivec4<T, S>::map(*this, _x, _y, _z, _w);
}
template<IntType T, bool A>
TIntVector4<T, A>::TIntVector4(const T s)
template<IntType T, bool S>
TIntVector4<T, S>::TIntVector4(const T s)
{
Detail::construct_ivec4<T, SIMD::use_simd<T, 4, A>::value>::map(*this, s);
Detail::construct_ivec4<T, S>::map(*this, s);
}
template<IntType T, bool A>
TIntVector4<T, A>::TIntVector4(const T* comp)
template<IntType T, bool S>
TIntVector4<T, S>::TIntVector4(const T* comp)
{
Detail::construct_ivec4<T, SIMD::use_simd<T, 4, A>::value>::map(*this, comp);
Detail::construct_ivec4<T, S>::map(*this, comp);
}
template<IntType T, bool A>
TIntVector4<T, A>::TIntVector4(const TIntVector2<T, A>& v1, const TIntVector2<T, A>& v2)
template<IntType T, bool S>
TIntVector4<T, S>::TIntVector4(const TIntVector2<T, S>& v1, const TIntVector2<T, S>& v2)
{
Detail::construct_ivec4<T, SIMD::use_simd<T, 4, A>::value>::map(*this, v1, v2);
Detail::construct_ivec4<T, S>::map(*this, v1, v2);
}
template<IntType T, bool A>
TIntVector4<T, A> operator+=(TIntVector4<T, A>& v1, const TIntVector4<T, A>& v2)
template<IntType T, bool S>
TIntVector4<T, S> operator+=(TIntVector4<T, S>& v1, const TIntVector4<T, S>& v2)
{
Detail::compute_ivec4_add<T, SIMD::use_simd<T, 4, A>::value>::map(v1, v1, v2);
Detail::compute_ivec4_add<T, S>::map(v1, v1, v2);
return v1;
}
template<IntType T, bool A>
TIntVector4<T, A> operator+=(TIntVector4<T, A>& v1, T s)
template<IntType T, bool S>
TIntVector4<T, S> operator+=(TIntVector4<T, S>& v1, T s)
{
Detail::compute_ivec4_add<T, SIMD::use_simd<T, 4, A>::value>::map(v1, v1, s);
Detail::compute_ivec4_add<T, S>::map(v1, v1, s);
return v1;
}
template<IntType T, bool A>
TIntVector4<T, A> operator-=(TIntVector4<T, A>& v1, const TIntVector4<T, A>& v2)
template<IntType T, bool S>
TIntVector4<T, S> operator-=(TIntVector4<T, S>& v1, const TIntVector4<T, S>& v2)
{
Detail::compute_ivec4_sub<T, SIMD::use_simd<T, 4, A>::value>::map(v1, v1, v2);
Detail::compute_ivec4_sub<T, S>::map(v1, v1, v2);
return v1;
}
template<IntType T, bool A>
TIntVector4<T, A> operator-=(TIntVector4<T, A>& v1, T s)
template<IntType T, bool S>
TIntVector4<T, S> operator-=(TIntVector4<T, S>& v1, T s)
{
Detail::compute_ivec4_sub<T, SIMD::use_simd<T, 4, A>::value>::map(v1, v1, s);
Detail::compute_ivec4_sub<T, S>::map(v1, v1, s);
return v1;
}
template<IntType T, bool A>
TIntVector4<T, A> operator*=(TIntVector4<T, A>& v1, const TIntVector4<T, A>& v2)
template<IntType T, bool S>
TIntVector4<T, S> operator*=(TIntVector4<T, S>& v1, const TIntVector4<T, S>& v2)
{
Detail::compute_ivec4_mul<T, SIMD::use_simd<T, 4, A>::value>::map(v1, v1, v2);
Detail::compute_ivec4_mul<T, S>::map(v1, v1, v2);
return v1;
}
template<IntType T, bool A>
TIntVector4<T, A> operator*=(TIntVector4<T, A>& v1, T s)
template<IntType T, bool S>
TIntVector4<T, S> operator*=(TIntVector4<T, S>& v1, T s)
{
Detail::compute_ivec4_mul<T, SIMD::use_simd<T, 4, A>::value>::map(v1, v1, s);
Detail::compute_ivec4_mul<T, S>::map(v1, v1, s);
return v1;
}
template<IntType T, bool A>
TIntVector4<T, A> operator/=(TIntVector4<T, A>& v1, const TIntVector4<T, A>& v2)
template<IntType T, bool S>
TIntVector4<T, S> operator/=(TIntVector4<T, S>& v1, const TIntVector4<T, S>& v2)
{
Detail::compute_ivec4_div<T, SIMD::use_simd<T, 4, A>::value>::map(v1, v1, v2);
Detail::compute_ivec4_div<T, S>::map(v1, v1, v2);
return v1;
}
template<IntType T, bool A>
TIntVector4<T, A> operator/=(TIntVector4<T, A>& v1, T s)
template<IntType T, bool S>
TIntVector4<T, S> operator/=(TIntVector4<T, S>& v1, T s)
{
Detail::compute_ivec4_div<T, SIMD::use_simd<T, 4, A>::value>::map(v1, v1, s);
Detail::compute_ivec4_div<T, S>::map(v1, v1, s);
return v1;
}
template<IntType T, bool A>
TIntVector4<T, A> operator%=(TIntVector4<T, A>& v1, const TIntVector4<T, A>& v2)
template<IntType T, bool S>
TIntVector4<T, S> operator%=(TIntVector4<T, S>& v1, const TIntVector4<T, S>& v2)
{
Detail::compute_ivec4_mod<T, SIMD::use_simd<T, 4, A>::value>::map(v1, v1, v2);
Detail::compute_ivec4_mod<T, S>::map(v1, v1, v2);
return v1;
}
template<IntType T, bool A>
TIntVector4<T, A> operator%=(TIntVector4<T, A>& v1, T s)
template<IntType T, bool S>
TIntVector4<T, S> operator%=(TIntVector4<T, S>& v1, T s)
{
Detail::compute_ivec4_mod<T, SIMD::use_simd<T, 4, A>::value>::map(v1, v1, s);
Detail::compute_ivec4_mod<T, S>::map(v1, v1, s);
return v1;
}
template<IntType T, bool A>
TIntVector4<T, A> operator+(TIntVector4<T, A>& v1, const TIntVector4<T, A>& v2)
template<IntType T, bool S>
TIntVector4<T, S> operator+(TIntVector4<T, S>& v1, const TIntVector4<T, S>& v2)
{
TIntVector4<T, A> r;
Detail::compute_ivec4_add<T, SIMD::use_simd<T, 4, A>::value>::map(r, v1, v2);
TIntVector4<T, S> r;
Detail::compute_ivec4_add<T, S>::map(r, v1, v2);
return r;
}
template<IntType T, bool A>
TIntVector4<T, A> operator+(TIntVector4<T, A>& v1, T s)
template<IntType T, bool S>
TIntVector4<T, S> operator+(TIntVector4<T, S>& v1, T s)
{
TIntVector4<T, A> r;
Detail::compute_ivec4_add<T, SIMD::use_simd<T, 4, A>::value>::map(r, v1, s);
TIntVector4<T, S> r;
Detail::compute_ivec4_add<T, S>::map(r, v1, s);
return r;
}
template<IntType T, bool A>
TIntVector4<T, A> operator-(TIntVector4<T, A>& v1, const TIntVector4<T, A>& v2)
template<IntType T, bool S>
TIntVector4<T, S> operator-(TIntVector4<T, S>& v1, const TIntVector4<T, S>& v2)
{
TIntVector4<T, A> r;
Detail::compute_ivec4_sub<T, SIMD::use_simd<T, 4, A>::value>::map(r, v1, v2);
TIntVector4<T, S> r;
Detail::compute_ivec4_sub<T, S>::map(r, v1, v2);
return r;
}
template<IntType T, bool A>
TIntVector4<T, A> operator-(TIntVector4<T, A>& v1, T s)
template<IntType T, bool S>
TIntVector4<T, S> operator-(TIntVector4<T, S>& v1, T s)
{
TIntVector4<T, A> r;
Detail::compute_ivec4_sub<T, SIMD::use_simd<T, 4, A>::value>::map(r, v1, s);
TIntVector4<T, S> r;
Detail::compute_ivec4_sub<T, S>::map(r, v1, s);
return r;
}
template<IntType T, bool A>
TIntVector4<T, A> operator*(TIntVector4<T, A>& v1, const TIntVector4<T, A>& v2)
template<IntType T, bool S>
TIntVector4<T, S> operator*(TIntVector4<T, S>& v1, const TIntVector4<T, S>& v2)
{
TIntVector4<T, A> r;
Detail::compute_ivec4_mul<T, SIMD::use_simd<T, 4, A>::value>::map(r, v1, v2);
TIntVector4<T, S> r;
Detail::compute_ivec4_mul<T, S>::map(r, v1, v2);
return r;
}
template<IntType T, bool A>
TIntVector4<T, A> operator*(TIntVector4<T, A>& v1, T s)
template<IntType T, bool S>
TIntVector4<T, S> operator*(TIntVector4<T, S>& v1, T s)
{
TIntVector4<T, A> r;
Detail::compute_ivec4_mul<T, SIMD::use_simd<T, 4, A>::value>::map(r, v1, s);
TIntVector4<T, S> r;
Detail::compute_ivec4_mul<T, S>::map(r, v1, s);
return r;
}
template<IntType T, bool A>
TIntVector4<T, A> operator/(TIntVector4<T, A>& v1, const TIntVector4<T, A>& v2)
template<IntType T, bool S>
TIntVector4<T, S> operator/(TIntVector4<T, S>& v1, const TIntVector4<T, S>& v2)
{
TIntVector4<T, A> r;
Detail::compute_ivec4_div<T, SIMD::use_simd<T, 4, A>::value>::map(r, v1, v2);
TIntVector4<T, S> r;
Detail::compute_ivec4_div<T, S>::map(r, v1, v2);
return r;
}
template<IntType T, bool A>
TIntVector4<T, A> operator/(TIntVector4<T, A>& v1, T s)
template<IntType T, bool S>
TIntVector4<T, S> operator/(TIntVector4<T, S>& v1, T s)
{
TIntVector4<T, A> r;
Detail::compute_ivec4_div<T, SIMD::use_simd<T, 4, A>::value>::map(r, v1, s);
TIntVector4<T, S> r;
Detail::compute_ivec4_div<T, S>::map(r, v1, s);
return r;
}
template<IntType T, bool A>
TIntVector4<T, A> operator%(TIntVector4<T, A>& v1, const TIntVector4<T, A>& v2)
template<IntType T, bool S>
TIntVector4<T, S> operator%(TIntVector4<T, S>& v1, const TIntVector4<T, S>& v2)
{
TIntVector4<T, A> r;
Detail::compute_ivec4_mod<T, SIMD::use_simd<T, 4, A>::value>::map(r, v1, v2);
TIntVector4<T, S> r;
Detail::compute_ivec4_mod<T, S>::map(r, v1, v2);
return r;
}
template<IntType T, bool A>
TIntVector4<T, A> operator%(TIntVector4<T, A>& v1, T s)
template<IntType T, bool S>
TIntVector4<T, S> operator%(TIntVector4<T, S>& v1, T s)
{
TIntVector4<T, A> r;
Detail::compute_ivec4_mod<T, SIMD::use_simd<T, 4, A>::value>::map(r, v1, s);
TIntVector4<T, S> r;
Detail::compute_ivec4_mod<T, S>::map(r, v1, s);
return r;
}
@ -198,163 +198,163 @@ namespace Phanes::Core::Math
// Bitwise operators
template<IntType T, bool A>
TIntVector4<T, A> operator&=(TIntVector4<T, A>& v1, const TIntVector4<T, A>& v2)
template<IntType T, bool S>
TIntVector4<T, S> operator&=(TIntVector4<T, S>& v1, const TIntVector4<T, S>& v2)
{
Detail::compute_ivec4_and<T, SIMD::use_simd<T, 4, A>::value>::map(v1, v1, v2);
Detail::compute_ivec4_and<T, S>::map(v1, v1, v2);
return v1;
}
template<IntType T, bool A>
TIntVector4<T, A> operator&=(TIntVector4<T, A>& v1, T s)
template<IntType T, bool S>
TIntVector4<T, S> operator&=(TIntVector4<T, S>& v1, T s)
{
Detail::compute_ivec4_and<T, SIMD::use_simd<T, 4, A>::value>::map(v1, v1, s);
Detail::compute_ivec4_and<T, S>::map(v1, v1, s);
return v1;
}
template<IntType T, bool A>
TIntVector4<T, A> operator|=(TIntVector4<T, A>& v1, const TIntVector4<T, A>& v2)
template<IntType T, bool S>
TIntVector4<T, S> operator|=(TIntVector4<T, S>& v1, const TIntVector4<T, S>& v2)
{
Detail::compute_ivec4_or<T, SIMD::use_simd<T, 4, A>::value>::map(v1, v1, v2);
Detail::compute_ivec4_or<T, S>::map(v1, v1, v2);
return v1;
}
template<IntType T, bool A>
TIntVector4<T, A> operator|=(TIntVector4<T, A>& v1, T s)
template<IntType T, bool S>
TIntVector4<T, S> operator|=(TIntVector4<T, S>& v1, T s)
{
Detail::compute_ivec4_or<T, SIMD::use_simd<T, 4, A>::value>::map(v1, v1, s);
Detail::compute_ivec4_or<T, S>::map(v1, v1, s);
return v1;
}
template<IntType T, bool A>
TIntVector4<T, A> operator^=(TIntVector4<T, A>& v1, const TIntVector4<T, A>& v2)
template<IntType T, bool S>
TIntVector4<T, S> operator^=(TIntVector4<T, S>& v1, const TIntVector4<T, S>& v2)
{
Detail::compute_ivec4_xor<T, SIMD::use_simd<T, 4, A>::value>::map(v1, v1, v2);
Detail::compute_ivec4_xor<T, S>::map(v1, v1, v2);
return v1;
}
template<IntType T, bool A>
TIntVector4<T, A> operator^=(TIntVector4<T, A>& v1, T s)
template<IntType T, bool S>
TIntVector4<T, S> operator^=(TIntVector4<T, S>& v1, T s)
{
Detail::compute_ivec4_xor<T, SIMD::use_simd<T, 4, A>::value>::map(v1, v1, s);
Detail::compute_ivec4_xor<T, S>::map(v1, v1, s);
return v1;
}
template<IntType T, bool A>
TIntVector4<T, A> operator<<=(TIntVector4<T, A>& v1, const TIntVector4<T, A>& v2)
template<IntType T, bool S>
TIntVector4<T, S> operator<<=(TIntVector4<T, S>& v1, const TIntVector4<T, S>& v2)
{
Detail::compute_ivec4_left_shift<T, SIMD::use_simd<T, 4, A>::value>::map(v1, v1, v2);
Detail::compute_ivec4_left_shift<T, S>::map(v1, v1, v2);
return v1;
}
template<IntType T, bool A>
TIntVector4<T, A> operator<<=(TIntVector4<T, A>& v1, T s)
template<IntType T, bool S>
TIntVector4<T, S> operator<<=(TIntVector4<T, S>& v1, T s)
{
Detail::compute_ivec4_left_shift<T, SIMD::use_simd<T, 4, A>::value>::map(v1, v1, s);
Detail::compute_ivec4_left_shift<T, S>::map(v1, v1, s);
return v1;
}
template<IntType T, bool A>
TIntVector4<T, A> operator>>=(TIntVector4<T, A>& v1, const TIntVector4<T, A>& v2)
template<IntType T, bool S>
TIntVector4<T, S> operator>>=(TIntVector4<T, S>& v1, const TIntVector4<T, S>& v2)
{
Detail::compute_ivec4_right_shift<T, SIMD::use_simd<T, 4, A>::value>::map(v1, v1, v2);
Detail::compute_ivec4_right_shift<T, S>::map(v1, v1, v2);
return v1;
}
template<IntType T, bool A>
TIntVector4<T, A> operator>>=(TIntVector4<T, A>& v1, T s)
template<IntType T, bool S>
TIntVector4<T, S> operator>>=(TIntVector4<T, S>& v1, T s)
{
Detail::compute_ivec4_right_shift<T, SIMD::use_simd<T, 4, A>::value>::map(v1, v1, s);
Detail::compute_ivec4_right_shift<T, S>::map(v1, v1, s);
return v1;
}
template<IntType T, bool A>
TIntVector4<T, A> operator&(TIntVector4<T, A>& v1, const TIntVector4<T, A>& v2)
template<IntType T, bool S>
TIntVector4<T, S> operator&(TIntVector4<T, S>& v1, const TIntVector4<T, S>& v2)
{
TVector2<T, A> r;
Detail::compute_ivec4_and<T, SIMD::use_simd<T, 4, A>::value>::map(r, v1, v2);
TVector2<T, S> r;
Detail::compute_ivec4_and<T, S>::map(r, v1, v2);
return r;
}
template<IntType T, bool A>
TIntVector4<T, A> operator&(TIntVector4<T, A>& v1, T s)
template<IntType T, bool S>
TIntVector4<T, S> operator&(TIntVector4<T, S>& v1, T s)
{
TVector2<T, A> r;
Detail::compute_ivec4_and<T, SIMD::use_simd<T, 4, A>::value>::map(r, v1, s);
TVector2<T, S> r;
Detail::compute_ivec4_and<T, S>::map(r, v1, s);
return r;
}
template<IntType T, bool A>
TIntVector4<T, A> operator|(TIntVector4<T, A>& v1, const TIntVector4<T, A>& v2)
template<IntType T, bool S>
TIntVector4<T, S> operator|(TIntVector4<T, S>& v1, const TIntVector4<T, S>& v2)
{
TVector2<T, A> r;
Detail::compute_ivec4_or<T, SIMD::use_simd<T, 4, A>::value>::map(r, v1, v2);
TVector2<T, S> r;
Detail::compute_ivec4_or<T, S>::map(r, v1, v2);
return r;
}
template<IntType T, bool A>
TIntVector4<T, A> operator|(TIntVector4<T, A>& v1, T s)
template<IntType T, bool S>
TIntVector4<T, S> operator|(TIntVector4<T, S>& v1, T s)
{
TVector2<T, A> r;
Detail::compute_ivec4_or<T, SIMD::use_simd<T, 4, A>::value>::map(r, v1, s);
TVector2<T, S> r;
Detail::compute_ivec4_or<T, S>::map(r, v1, s);
return r;
}
template<IntType T, bool A>
TIntVector4<T, A> operator^(TIntVector4<T, A>& v1, const TIntVector4<T, A>& v2)
template<IntType T, bool S>
TIntVector4<T, S> operator^(TIntVector4<T, S>& v1, const TIntVector4<T, S>& v2)
{
TVector2<T, A> r;
Detail::compute_ivec4_xor<T, SIMD::use_simd<T, 4, A>::value>::map(r, v1, v2);
TVector2<T, S> r;
Detail::compute_ivec4_xor<T, S>::map(r, v1, v2);
return r;
}
template<IntType T, bool A>
TIntVector4<T, A> operator^(TIntVector4<T, A>& v1, T s)
template<IntType T, bool S>
TIntVector4<T, S> operator^(TIntVector4<T, S>& v1, T s)
{
TVector2<T, A> r;
Detail::compute_ivec4_xor<T, SIMD::use_simd<T, 4, A>::value>::map(r, v1, s);
TVector2<T, S> r;
Detail::compute_ivec4_xor<T, S>::map(r, v1, s);
return r;
}
template<IntType T, bool A>
TIntVector4<T, A> operator<<(TIntVector4<T, A>& v1, const TIntVector4<T, A>& v2)
template<IntType T, bool S>
TIntVector4<T, S> operator<<(TIntVector4<T, S>& v1, const TIntVector4<T, S>& v2)
{
TVector2<T, A> r;
Detail::compute_ivec4_left_shift<T, SIMD::use_simd<T, 4, A>::value>::map(r, v1, v2);
TVector2<T, S> r;
Detail::compute_ivec4_left_shift<T, S>::map(r, v1, v2);
return r;
}
template<IntType T, bool A>
TIntVector4<T, A> operator<<(TIntVector4<T, A>& v1, T s)
template<IntType T, bool S>
TIntVector4<T, S> operator<<(TIntVector4<T, S>& v1, T s)
{
TVector2<T, A> r;
Detail::compute_ivec4_left_shift<T, SIMD::use_simd<T, 4, A>::value>::map(r, v1, s);
TVector2<T, S> r;
Detail::compute_ivec4_left_shift<T, S>::map(r, v1, s);
return r;
}
template<IntType T, bool A>
TIntVector4<T, A> operator>>(TIntVector4<T, A>& v1, const TIntVector4<T, A>& v2)
template<IntType T, bool S>
TIntVector4<T, S> operator>>(TIntVector4<T, S>& v1, const TIntVector4<T, S>& v2)
{
TVector2<T, A> r;
Detail::compute_ivec4_right_shift<T, SIMD::use_simd<T, 4, A>::value>::map(r, v1, v2);
TVector2<T, S> r;
Detail::compute_ivec4_right_shift<T, S>::map(r, v1, v2);
return r;
}
template<IntType T, bool A>
TIntVector4<T, A> operator>>(TIntVector4<T, A>& v1, T s)
template<IntType T, bool S>
TIntVector4<T, S> operator>>(TIntVector4<T, S>& v1, T s)
{
TVector2<T, A> r;
Detail::compute_ivec4_right_shift<T, SIMD::use_simd<T, 4, A>::value>::map(r, v1, s);
TVector2<T, S> r;
Detail::compute_ivec4_right_shift<T, S>::map(r, v1, s);
return r;
}
template<IntType T, bool A>
TIntVector4<T, A> operator~(TIntVector4<T, A>& v1)
template<IntType T, bool S>
TIntVector4<T, S> operator~(TIntVector4<T, S>& v1)
{
TVector2<T, A> r;
Detail::compute_ivec4_bnot<T, SIMD::use_simd<T, 4, A>::value>::map(r, v1);
TVector2<T, S> r;
Detail::compute_ivec4_bnot<T, S>::map(r, v1);
return r;
}
@ -362,16 +362,16 @@ namespace Phanes::Core::Math
// Comparision
template<IntType T, bool A>
bool operator==(const TIntVector4<T, A>& v1, const TIntVector4<T, A>& v2)
template<IntType T, bool S>
bool operator==(const TIntVector4<T, S>& v1, const TIntVector4<T, S>& v2)
{
return Detail::compute_ivec4_eq<T, SIMD::use_simd<T, 4, A>::value>::map(v1, v2);
return Detail::compute_ivec4_eq<T, S>::map(v1, v2);
}
template<IntType T, bool A>
bool operator!=(const TIntVector4<T, A>& v1, const TIntVector4<T, A>& v2)
template<IntType T, bool S>
bool operator!=(const TIntVector4<T, S>& v1, const TIntVector4<T, S>& v2)
{
return Detail::compute_ivec4_ieq<T, SIMD::use_simd<T, 4, A>::value>::map(v1, v2);
return Detail::compute_ivec4_ieq<T, S>::map(v1, v2);
}
@ -379,28 +379,28 @@ namespace Phanes::Core::Math
// Inc- / Decrement
template<IntType T, bool A>
TIntVector4<T, A>& operator++(TIntVector4<T, A>& v1)
template<IntType T, bool S>
TIntVector4<T, S>& operator++(TIntVector4<T, S>& v1)
{
Detail::compute_ivec4_inc<T, SIMD::use_simd<T, 4, A>::value>::map(v1);
Detail::compute_ivec4_inc<T, S>::map(v1);
return v1;
}
template<IntType T, bool A>
TIntVector4<T, A>& operator--(TIntVector4<T, A>& v1)
template<IntType T, bool S>
TIntVector4<T, S>& operator--(TIntVector4<T, S>& v1)
{
Detail::compute_ivec4_inc<T, SIMD::use_simd<T, 4, A>::value>::map(v1);
Detail::compute_ivec4_inc<T, S>::map(v1);
return v1;
}
template<IntType T, bool A>
TIntVector4<T, A>& operator++(TIntVector4<T, A>& v1, int)
template<IntType T, bool S>
TIntVector4<T, S>& operator++(TIntVector4<T, S>& v1, int)
{
return ++v1;
}
template<IntType T, bool A>
TIntVector4<T, A>& operator--(TIntVector4<T, A>& v1, int)
template<IntType T, bool S>
TIntVector4<T, S>& operator--(TIntVector4<T, S>& v1, int)
{
return --v1;
}

View File

@ -1,946 +0,0 @@
#pragma once
#include <nmmintrin.h>
#include "Core/public/Math/SIMD/PhanesSIMDTypes.h"
#include "Core/public/Math/Boilerplate.h"
#include "Core/public/Math/MathCommon.hpp"
// Required includes
#include "Core/public/Math/Vector3.hpp"
#include "Core/public/Math/Vector4.hpp"
// ========== //
// Common //
// ========== //
namespace Phanes::Core::Math::SIMD
{
/// <summary>
/// Adds all scalars of the vector.
/// </summary>
/// <param name="v">Vector</param>
/// <returns>Sum stored in v[0:31].</returns>
Phanes::Core::Types::Vec4f32Reg vec4_hadd(const Phanes::Core::Types::Vec4f32Reg v)
{
Phanes::Core::Types::Vec4f32Reg r;
r.data[0] = (v.data[0] + v.data[1] + v.data[2] + v.data[3]);
return r;
}
/// <summary>
/// Adds all scalars of the vector.
/// </summary>
/// <param name="v">Vector</param>
/// <returns>Sum of components.</returns>
float vec4_hadd_cvtf32(const Phanes::Core::Types::Vec4f32Reg v)
{
return (v.data[0] + v.data[1] + v.data[2] + v.data[3]);
}
/// <summary>
/// Gets the absolute value of each scalar in the vector.
/// </summary>
/// <param name="v">Vector</param>
/// <returns>Vector with all components positive.</returns>
Phanes::Core::Types::Vec4f32Reg vec4_abs(const Phanes::Core::Types::Vec4f32Reg v)
{
Phanes::Core::Types::Vec4f32Reg r;
r.data[0] = Phanes::Core::Math::Abs(v.data[0]);
r.data[1] = Phanes::Core::Math::Abs(v.data[1]);
r.data[2] = Phanes::Core::Math::Abs(v.data[2]);
r.data[3] = Phanes::Core::Math::Abs(v.data[3]);
return r;
}
/// <summary>
/// Gets the dot product of the
/// </summary>
/// <param name="v1"></param>
/// <param name="v2"></param>
/// <returns></returns>
Phanes::Core::Types::Vec4f32Reg vec4_dot(const Phanes::Core::Types::Vec4f32Reg v1, const Phanes::Core::Types::Vec4f32Reg v2)
{
Phanes::Core::Types::Vec4f32Reg r;
r.data[0] = (v1.data[0] * v2.data[0] + v1.data[1] * v2.data[1] + v1.data[2] * v2.data[2] + v1.data[3] * v2.data[3]);
return r;
}
/// <summary>
/// Gets the dot product of the
/// </summary>
/// <param name="v1"></param>
/// <param name="v2"></param>
/// <returns></returns>
float vec4_dot_cvtf32(const Phanes::Core::Types::Vec4f32Reg v1, const Phanes::Core::Types::Vec4f32Reg v2)
{
return (v1.data[0] * v2.data[0] + v1.data[1] * v2.data[1] + v1.data[2] * v2.data[2] + v1.data[3] * v2.data[3]);
}
}
// ============ //
// TVector4 //
// ============ //
namespace Phanes::Core::Math::Detail
{
// Template class has already been defined and is included through: Storage.h -> Vector4.hpp -> SIMDIntrinsics.h -> PhanesVectorMathSEE.hpp
template<>
struct construct_vec4<float, true>
{
static FORCEINLINE void map(Phanes::Core::Math::TVector4<float, true>& v1, const TVector4<float, true>& v2)
{
v1.x = v2.x;
v1.y = v2.y;
v1.z = v2.z;
v1.w = v2.w;
}
static FORCEINLINE void map(Phanes::Core::Math::TVector4<float, true>& v1, float s)
{
v1.x = s;
v1.y = s;
v1.z = s;
v1.w = s;
}
static FORCEINLINE void map(Phanes::Core::Math::TVector4<float, true>& v1, float x, float y, float z, float w)
{
v1.x = x;
v1.y = y;
v1.z = z;
v1.w = w;
}
static FORCEINLINE void map(Phanes::Core::Math::TVector4<float, true>& v1, const Phanes::Core::Math::TVector2<float, false>& v2, const Phanes::Core::Math::TVector2<float, false>& v3)
{
v1.x = v2.x;
v1.y = v2.y;
v1.x = v3.x;
v1.y = v3.y;
}
static FORCEINLINE void map(Phanes::Core::Math::TVector4<float, true>& v1, const float* s)
{
v1.x = s[0];
v1.y = s[1];
v1.z = s[2];
v1.w = s[3];
}
};
template<>
struct compute_vec4_add<float, true>
{
static FORCEINLINE void map(Phanes::Core::Math::TVector4<float, true>& r, const Phanes::Core::Math::TVector4<float, true>& v1, const Phanes::Core::Math::TVector4<float, true>& v2)
{
r.x = v1.x + v2.x;
r.y = v1.y + v2.y;
r.z = v1.z + v2.z;
r.w = v1.w + v2.w;
}
static FORCEINLINE void map(Phanes::Core::Math::TVector4<float, true>& r, const Phanes::Core::Math::TVector4<float, true>& v1, float s)
{
r.x = v1.x + s;
r.y = v1.y + s;
r.z = v1.z + s;
r.w = v1.w + s;
}
};
template<>
struct compute_vec4_sub<float, true>
{
static FORCEINLINE void map(Phanes::Core::Math::TVector4<float, true>& r, const Phanes::Core::Math::TVector4<float, true>& v1, const Phanes::Core::Math::TVector4<float, true>& v2)
{
r.x = v1.x - v2.x;
r.y = v1.y - v2.y;
r.z = v1.z - v2.z;
r.w = v1.w - v2.w;
}
static FORCEINLINE void map(Phanes::Core::Math::TVector4<float, true>& r, const Phanes::Core::Math::TVector4<float, true>& v1, float s)
{
r.x = v1.x - s;
r.y = v1.y - s;
r.z = v1.z - s;
r.w = v1.w - s;
}
};
template<>
struct compute_vec4_mul<float, true>
{
static FORCEINLINE void map(Phanes::Core::Math::TVector4<float, true>& r, const Phanes::Core::Math::TVector4<float, true>& v1, const Phanes::Core::Math::TVector4<float, true>& v2)
{
r.x = v1.x * v2.x;
r.y = v1.y * v2.y;
r.z = v1.z * v2.z;
r.w = v1.w * v2.w;
}
static FORCEINLINE void map(Phanes::Core::Math::TVector4<float, true>& r, const Phanes::Core::Math::TVector4<float, true>& v1, float s)
{
r.x = v1.x * s;
r.y = v1.y * s;
r.z = v1.z * s;
r.w = v1.w * s;
}
};
template<>
struct compute_vec4_div<float, true>
{
static FORCEINLINE void map(Phanes::Core::Math::TVector4<float, true>& r, const Phanes::Core::Math::TVector4<float, true>& v1, const Phanes::Core::Math::TVector4<float, true>& v2)
{
r.x = v1.x / v2.x;
r.y = v1.y / v2.y;
r.z = v1.z / v2.z;
r.w = v1.w / v2.w;
}
static FORCEINLINE void map(Phanes::Core::Math::TVector4<float, true>& r, const Phanes::Core::Math::TVector4<float, true>& v1, float s)
{
s = 1.0f / s;
r.x = v1.x * s;
r.y = v1.y * s;
r.z = v1.z * s;
r.w = v1.w * s;
}
};
template<>
struct compute_vec4_inc<float, true>
{
static FORCEINLINE void map(Phanes::Core::Math::TVector4<float, true>& r, const Phanes::Core::Math::TVector4<float, true>& v1)
{
r.x = v1.x + 1;
r.y = v1.y + 1;
r.z = v1.z + 1;
r.w = v1.w + 1;
}
};
template<>
struct compute_vec4_dec<float, true>
{
static FORCEINLINE void map(Phanes::Core::Math::TVector4<float, true>& r, const Phanes::Core::Math::TVector4<float, true>& v1)
{
r.x = v1.x - 1;
r.y = v1.y - 1;
r.z = v1.z - 1;
r.w = v1.w - 1;
}
};
template<>
struct compute_vec4_eq<float, true>
{
static FORCEINLINE bool map(const Phanes::Core::Math::TVector4<float, true>& v1, const Phanes::Core::Math::TVector4<float, true>& v2)
{
return (Phanes::Core::Math::Abs(v1.x - v2.x) < P_FLT_INAC &&
Phanes::Core::Math::Abs(v1.y - v2.y) < P_FLT_INAC &&
Phanes::Core::Math::Abs(v1.z - v2.z) < P_FLT_INAC &&
Phanes::Core::Math::Abs(v1.w - v2.w) < P_FLT_INAC);
}
};
template<>
struct compute_vec4_ieq<float, true>
{
static FORCEINLINE bool map(const Phanes::Core::Math::TVector4<float, true>& v1, const Phanes::Core::Math::TVector4<float, true>& v2)
{
return (Phanes::Core::Math::Abs(v1.x - v2.x) > P_FLT_INAC ||
Phanes::Core::Math::Abs(v1.y - v2.y) > P_FLT_INAC ||
Phanes::Core::Math::Abs(v1.z - v2.z) > P_FLT_INAC ||
Phanes::Core::Math::Abs(v1.w - v2.w) > P_FLT_INAC);
}
};
// ============ //
// TVector3 //
// ============ //
template<>
struct construct_vec3<float, true>
{
static FORCEINLINE void map(Phanes::Core::Math::TVector3<float, true>& v1, const TVector3<float, true>& v2)
{
v1.x = v2.x;
v1.y = v2.y;
v1.z = v2.z;
v1.w = 0.0f;
}
static FORCEINLINE void map(Phanes::Core::Math::TVector3<float, true>& v1, float s)
{
v1.x = s;
v1.y = s;
v1.z = s;
v1.w = 0.0f;
}
static FORCEINLINE void map(Phanes::Core::Math::TVector3<float, true>& v1, float x, float y, float z)
{
v1.x = x;
v1.y = y;
v1.z = z;
v1.w = 0.0f;
}
static FORCEINLINE void map(Phanes::Core::Math::TVector3<float, true>& v1, const Phanes::Core::Math::TVector2<float, true>& v2, float s)
{
v1.x = v2.x;
v1.y = v2.y;
v1.z = s;
}
static FORCEINLINE void map(Phanes::Core::Math::TVector3<float, true>& v1, const float* comp)
{
v1.x = comp[0];
v1.y = comp[1];
v1.z = comp[2];
v1.w = 0.0f;
}
};
template<> struct compute_vec3_eq<float, true> : public compute_vec4_eq<float, true>
{
static FORCEINLINE bool map(Phanes::Core::Math::TVector3<float, true>& v1, Phanes::Core::Math::TVector3<float, true>& v2)
{
return (Phanes::Core::Math::Abs(v1.x - v2.x) < P_FLT_INAC &&
Phanes::Core::Math::Abs(v1.y - v2.y) < P_FLT_INAC &&
Phanes::Core::Math::Abs(v1.z - v2.z) < P_FLT_INAC);
}
};
template<> struct compute_vec3_ieq<float, true> : public compute_vec4_ieq<float, true>
{
static FORCEINLINE bool map(Phanes::Core::Math::TVector3<float, true>& v1, Phanes::Core::Math::TVector3<float, true>& v2)
{
return (Phanes::Core::Math::Abs(v1.x - v2.x) > P_FLT_INAC ||
Phanes::Core::Math::Abs(v1.y - v2.y) > P_FLT_INAC ||
Phanes::Core::Math::Abs(v1.z - v2.z) > P_FLT_INAC);
}
};
template<> struct compute_vec3_add<float, true> : public compute_vec4_add<float, true> {};
template<> struct compute_vec3_sub<float, true> : public compute_vec4_sub<float, true> {};
template<> struct compute_vec3_mul<float, true> : public compute_vec4_mul<float, true> {};
template<> struct compute_vec3_div<float, true> : public compute_vec4_div<float, true> {};
template<> struct compute_vec3_inc<float, true> : public compute_vec4_inc<float, true> {};
template<> struct compute_vec3_dec<float, true> : public compute_vec4_dec<float, true> {};
// ============ //
// TVector2 //
// ============ //
template<>
struct construct_vec2<double, true>
{
static FORCEINLINE void map(Phanes::Core::Math::TVector2<double, true>& v1, const Phanes::Core::Math::TVector2<double, true>& v2)
{
v1.x = v2.x;
v1.y = v2.y;
}
static FORCEINLINE void map(Phanes::Core::Math::TVector2<double, true>& v1, double s)
{
v1.x = s;
v1.y = s;
}
static FORCEINLINE void map(Phanes::Core::Math::TVector2<double, true>& v1, double x, double y)
{
v1.x = x;
v1.y = y;
}
static FORCEINLINE void map(Phanes::Core::Math::TVector2<double, true>& v1, const double* comp)
{
v1.x = comp[0];
v1.y = comp[1];
}
};
template<>
struct compute_vec2_add<double, true>
{
static FORCEINLINE void map(Phanes::Core::Math::TVector2<double, true>& r, const Phanes::Core::Math::TVector2<double, true>& v1, const Phanes::Core::Math::TVector2<double, true>& v2)
{
r.x = v1.x + v2.x;
r.y = v1.y + v2.y;
}
static FORCEINLINE void map(Phanes::Core::Math::TVector2<double, true>& r, const Phanes::Core::Math::TVector2<double, true>& v1, double s)
{
r.x = v1.x + s;
r.y = v1.y + s;
}
};
template<>
struct compute_vec2_sub<double, true>
{
static FORCEINLINE void map(Phanes::Core::Math::TVector2<double, true>& r, const Phanes::Core::Math::TVector2<double, true>& v1, const Phanes::Core::Math::TVector2<double, true>& v2)
{
r.x = v1.x - v2.x;
r.y = v1.y - v2.y;
}
static FORCEINLINE void map(Phanes::Core::Math::TVector2<double, true>& r, const Phanes::Core::Math::TVector2<double, true>& v1, double s)
{
r.x = v1.x - s;
r.y = v1.y - s;
}
};
template<>
struct compute_vec2_mul<double, true>
{
static FORCEINLINE void map(Phanes::Core::Math::TVector2<double, true>& r, const Phanes::Core::Math::TVector2<double, true>& v1, const Phanes::Core::Math::TVector2<double, true>& v2)
{
r.x = v1.x * v2.x;
r.y = v1.y * v2.y;
}
static FORCEINLINE void map(Phanes::Core::Math::TVector2<double, true>& r, const Phanes::Core::Math::TVector2<double, true>& v1, double s)
{
r.x = v1.x * s;
r.y = v1.y * s;
}
};
template<>
struct compute_vec2_div<double, true>
{
static FORCEINLINE void map(Phanes::Core::Math::TVector2<double, true>& r, const Phanes::Core::Math::TVector2<double, true>& v1, const Phanes::Core::Math::TVector2<double, true>& v2)
{
r.x = v1.x / v2.x;
r.y = v1.y / v2.y;
}
static FORCEINLINE void map(Phanes::Core::Math::TVector2<double, true>& r, const Phanes::Core::Math::TVector2<double, true>& v1, double s)
{
s = 1.0f / s;
r.x = v1.x * s;
r.y = v1.y * s;
}
};
template<>
struct compute_vec2_inc<double, true>
{
static FORCEINLINE void map(Phanes::Core::Math::TVector2<double, true>& r, const Phanes::Core::Math::TVector2<double, true>& v1)
{
r.x = v1.x + 1;
r.y = v1.y + 1;
}
};
template<>
struct compute_vec2_dec<double, true>
{
static FORCEINLINE void map(Phanes::Core::Math::TVector2<double, true>& r, const Phanes::Core::Math::TVector2<double, true>& v1)
{
r.x = v1.x - 1;
r.y = v1.y - 1;
}
};
template<>
struct compute_vec2_eq<double, true>
{
static FORCEINLINE bool map(const Phanes::Core::Math::TVector2<double, true>& v1, const Phanes::Core::Math::TVector2<double, true>& v2)
{
return (Phanes::Core::Math::Abs(v1.x - v2.x) < P_FLT_INAC &&
Phanes::Core::Math::Abs(v1.y - v2.y) < P_FLT_INAC);
}
};
template<>
struct compute_vec2_ieq<double, true>
{
static FORCEINLINE bool map(const Phanes::Core::Math::TVector2<double, true>& v1, const Phanes::Core::Math::TVector2<double, true>& v2)
{
return (Phanes::Core::Math::Abs(v1.x - v2.x) > P_FLT_INAC ||
Phanes::Core::Math::Abs(v1.y - v2.y) > P_FLT_INAC);
}
};
// =============== //
// TIntVector4 //
// =============== //
template<>
struct construct_ivec4<int, true>
{
static FORCEINLINE void map(Phanes::Core::Math::TIntVector4<int, true>& v1, const TIntVector4<int, true>& v2)
{
v1.x = v2.x;
v1.y = v2.y;
v1.z = v2.z;
v1.w = v2.w;
}
static FORCEINLINE void map(Phanes::Core::Math::TIntVector4<int, true>& v1, int s)
{
v1.x = s;
v1.y = s;
v1.z = s;
v1.w = s;
}
static FORCEINLINE void map(Phanes::Core::Math::TIntVector4<int, true>& v1, int x, int y, int z, int w)
{
v1.x = x;
v1.y = y;
v1.y = z;
v1.y = w;
}
static FORCEINLINE void map(Phanes::Core::Math::TIntVector4<int, true>& v1, const int* comp)
{
v1.x = comp[0];
v1.y = comp[1];
v1.z = comp[2];
v1.w = comp[3];
}
static FORCEINLINE void map(Phanes::Core::Math::TIntVector4<int, true>& r, const Phanes::Core::Math::TIntVector2<int, true>& v1, const Phanes::Core::Math::TIntVector2<int, true>& v2)
{
r.x = v1.x;
r.y = v1.y;
r.x = v2.x;
r.y = v2.y;
}
};
template<>
struct compute_ivec4_add<int, true>
{
static FORCEINLINE void map(Phanes::Core::Math::TIntVector4<int, true>& r, const Phanes::Core::Math::TIntVector4<int, true>& v1, const Phanes::Core::Math::TIntVector4<int, true>& v2)
{
r.x = v1.x + v2.x;
r.y = v1.y + v2.y;
r.z = v1.z + v2.z;
r.w = v1.w + v2.w;
}
static FORCEINLINE void map(Phanes::Core::Math::TIntVector4<int, true>& r, const Phanes::Core::Math::TIntVector4<int, true>& v1, int s)
{
r.x = v1.x + s;
r.y = v1.y + s;
r.z = v1.z + s;
r.w = v1.w + s;
}
};
template<>
struct compute_ivec4_sub<int, true>
{
static FORCEINLINE void map(Phanes::Core::Math::TIntVector4<int, true>& r, const Phanes::Core::Math::TIntVector4<int, true>& v1, const Phanes::Core::Math::TIntVector4<int, true>& v2)
{
r.x = v1.x - v2.x;
r.y = v1.y - v2.y;
r.z = v1.z - v2.z;
r.w = v1.w - v2.w;
}
static FORCEINLINE void map(Phanes::Core::Math::TIntVector4<int, true>& r, const Phanes::Core::Math::TIntVector4<int, true>& v1, int s)
{
r.x = v1.x - s;
r.y = v1.y - s;
r.z = v1.z - s;
r.w = v1.w - s;
}
};
template<>
struct compute_ivec4_mul<int, true>
{
static FORCEINLINE void map(Phanes::Core::Math::TIntVector4<int, true>& r, const Phanes::Core::Math::TIntVector4<int, true>& v1, const Phanes::Core::Math::TIntVector4<int, true>& v2)
{
r.x = v1.x * v2.x;
r.y = v1.y * v2.y;
r.z = v1.z * v2.z;
r.w = v1.w * v2.w;
}
static FORCEINLINE void map(Phanes::Core::Math::TIntVector4<int, true>& r, const Phanes::Core::Math::TIntVector4<int, true>& v1, int s)
{
r.x = v1.x * s;
r.y = v1.y * s;
r.z = v1.z * s;
r.w = v1.w * s;
}
};
template<>
struct compute_ivec4_inc<int, true>
{
static FORCEINLINE void map(Phanes::Core::Math::TIntVector4<int, true>& r, const Phanes::Core::Math::TIntVector4<int, true>& v1)
{
r.x = v1.x + 1;
r.y = v1.y + 1;
r.z = v1.z + 1;
r.w = v1.w + 1;
}
};
template<>
struct compute_ivec4_dec<int, true>
{
static FORCEINLINE void map(Phanes::Core::Math::TIntVector4<int, true>& r, const Phanes::Core::Math::TIntVector4<int, true>& v1)
{
r.x = v1.x - 1;
r.y = v1.y - 1;
r.z = v1.z - 1;
r.w = v1.w - 1;
}
};
template<>
struct compute_ivec4_and<int, true>
{
static FORCEINLINE void map(Phanes::Core::Math::TIntVector4<int, true>& r, const Phanes::Core::Math::TIntVector4<int, true>& v1, const Phanes::Core::Math::TIntVector4<int, true>& v2)
{
r.x = v1.x & v2.x;
r.y = v1.y & v2.y;
r.z = v1.z & v2.z;
r.w = v1.w & v2.w;
}
static FORCEINLINE void map(Phanes::Core::Math::TIntVector4<int, true>& r, const Phanes::Core::Math::TIntVector4<int, true>& v1, int s)
{
r.x = v1.x & s;
r.y = v1.y & s;
r.z = v1.z & s;
r.w = v1.w & s;
}
};
template<>
struct compute_ivec4_or<int, true>
{
static FORCEINLINE void map(Phanes::Core::Math::TIntVector4<int, true>& r, const Phanes::Core::Math::TIntVector4<int, true>& v1, const Phanes::Core::Math::TIntVector4<int, true>& v2)
{
r.x = v1.x | v2.x;
r.y = v1.y | v2.y;
r.z = v1.z | v2.z;
r.w = v1.w | v2.w;
}
static FORCEINLINE void map(Phanes::Core::Math::TIntVector4<int, true>& r, const Phanes::Core::Math::TIntVector4<int, true>& v1, int s)
{
r.x = v1.x | s;
r.y = v1.y | s;
r.z = v1.z | s;
r.w = v1.w | s;
}
};
template<>
struct compute_ivec4_xor<int, true>
{
static FORCEINLINE void map(Phanes::Core::Math::TIntVector4<int, true>& r, const Phanes::Core::Math::TIntVector4<int, true>& v1, const Phanes::Core::Math::TIntVector4<int, true>& v2)
{
r.x = v1.x ^ v2.x;
r.y = v1.y ^ v2.y;
r.z = v1.z ^ v2.z;
r.w = v1.w ^ v2.w;
}
static FORCEINLINE void map(Phanes::Core::Math::TIntVector4<int, true>& r, const Phanes::Core::Math::TIntVector4<int, true>& v1, int s)
{
r.x = v1.x ^ s;
r.y = v1.y ^ s;
r.z = v1.z ^ s;
r.w = v1.w ^ s;
}
};
template<>
struct compute_ivec4_left_shift<int, true>
{
static FORCEINLINE void map(Phanes::Core::Math::TIntVector4<int, true>& r, const Phanes::Core::Math::TIntVector4<int, true>& v1, const Phanes::Core::Math::TIntVector4<int, true>& v2)
{
r.x = v1.x << v2.x;
r.y = v1.y << v2.y;
r.z = v1.z << v2.z;
r.w = v1.w << v2.w;
}
static FORCEINLINE void map(Phanes::Core::Math::TIntVector4<int, true>& r, const Phanes::Core::Math::TIntVector4<int, true>& v1, int s)
{
r.x = v1.x << s;
r.y = v1.y << s;
r.z = v1.z << s;
r.w = v1.w << s;
}
};
template<>
struct compute_ivec4_right_shift<int, true>
{
static FORCEINLINE void map(Phanes::Core::Math::TIntVector4<int, true>& r, const Phanes::Core::Math::TIntVector4<int, true>& v1, const Phanes::Core::Math::TIntVector4<int, true>& v2)
{
r.x = v1.x >> v2.x;
r.y = v1.y >> v2.y;
r.z = v1.z >> v2.z;
r.w = v1.w >> v2.w;
}
static FORCEINLINE void map(Phanes::Core::Math::TIntVector4<int, true>& r, const Phanes::Core::Math::TIntVector4<int, true>& v1, int s)
{
r.x = v1.x >> s;
r.y = v1.y >> s;
r.z = v1.z >> s;
r.w = v1.w >> s;
}
};
// =============== //
// TIntVector3 //
// =============== //
template<>
struct construct_ivec3<int, true>
{
static FORCEINLINE void map(Phanes::Core::Math::TIntVector3<int, true>& v1, const TIntVector3<int, true>& v2)
{
v1.x = v2.x;
v1.y = v2.y;
v1.z = v2.z;
v1.w = (T)0;
}
static FORCEINLINE void map(Phanes::Core::Math::TIntVector3<int, true>& v1, int s)
{
v1.x = s;
v1.y = s;
v1.z = s;
v1.w = (T)0;
}
static FORCEINLINE void map(Phanes::Core::Math::TIntVector3<int, true>& v1, int x, int y, int z)
{
v1.x = x;
v1.y = y;
v1.y = z;
v1.w = (T)0;
}
static FORCEINLINE void map(Phanes::Core::Math::TIntVector3<int, true>& v1, const int* comp)
{
v1.x = comp[0];
v1.y = comp[1];
v1.z = comp[2];
v1.w = (T)0;
}
static FORCEINLINE void map(Phanes::Core::Math::TIntVector3<int, true>& r, const Phanes::Core::Math::TIntVector2<int, true>& v1, const int s)
{
v1.x = v2.x;
v1.y = v2.y;
v1.z = s;
v1.w = (T)0;
}
};
template<> struct compute_ivec3_add<int, true> : public compute_ivec4_add<int, true> {};
template<> struct compute_ivec3_sub<int, true> : public compute_ivec4_sub<int, true> {};
template<> struct compute_ivec3_mul<int, true> : public compute_ivec4_mul<int, true> {};
template<> struct compute_ivec3_div<int, true> : public compute_ivec4_div<int, true> {};
template<> struct compute_ivec3_inc<int, true> : public compute_ivec4_inc<int, true> {};
template<> struct compute_ivec3_dec<int, true> : public compute_ivec4_dec<int, true> {};
template<> struct compute_ivec3_and<int, true> : public compute_ivec4_and<int, true> {};
template<> struct compute_ivec3_or<int, true> : public compute_ivec4_or<int, true> {};
template<> struct compute_ivec3_xor<int, true> : public compute_ivec4_xor<int, true> {};
template<> struct compute_ivec3_left_shift<int, true> : public compute_ivec4_left_shift<int, true> {};
template<> struct compute_ivec3_right_shift<int, true> : public compute_ivec4_right_shift<int, true> {};
// =============== //
// TIntVector2 //
// =============== //
template<>
struct construct_ivec2<Phanes::Core::Types::int64, true>
{
static FORCEINLINE void map(Phanes::Core::Math::TIntVector2<Phanes::Core::Types::int64, true>& v1, const TIntVector2<Phanes::Core::Types::int64, true>& v2)
{
v1.comp = _mm_setr_epi64x(v2.x, v2.y);
}
static FORCEINLINE void map(Phanes::Core::Math::TIntVector2<Phanes::Core::Types::int64, true>& v1, Phanes::Core::Types::int64 s)
{
v1.comp = _mm_set1_epi64x(s);
}
static FORCEINLINE void map(Phanes::Core::Math::TIntVector2<Phanes::Core::Types::int64, true>& v1, Phanes::Core::Types::int64 x, Phanes::Core::Types::int64 y)
{
v1.comp = _mm_setr_epi64x(x, y);
}
static FORCEINLINE void map(Phanes::Core::Math::TIntVector2<Phanes::Core::Types::int64, true>& v1, const Phanes::Core::Types::int64* comp)
{
v1.comp = _mm_loadu_epi64(comp);
}
};
template<>
struct compute_ivec2_add<Phanes::Core::Types::int64, true>
{
static FORCEINLINE void map(Phanes::Core::Math::TIntVector2<Phanes::Core::Types::int64, true>& r, const Phanes::Core::Math::TIntVector2<Phanes::Core::Types::int64, true>& v1, const Phanes::Core::Math::TIntVector2<Phanes::Core::Types::int64, true>& v2)
{
r.comp = _mm_add_epi64(v1.comp, v2.comp);
}
static FORCEINLINE void map(Phanes::Core::Math::TIntVector2<Phanes::Core::Types::int64, true>& r, const Phanes::Core::Math::TIntVector2<Phanes::Core::Types::int64, true>& v1, T s)
{
r.comp = _mm_add_epi64(v1.comp, _mm_set1_epi64x(s));
}
};
template<>
struct compute_ivec2_sub<Phanes::Core::Types::int64, true>
{
static FORCEINLINE void map(Phanes::Core::Math::TIntVector2<Phanes::Core::Types::int64, true>& r, const Phanes::Core::Math::TIntVector2<Phanes::Core::Types::int64, true>& v1, const Phanes::Core::Math::TIntVector2<Phanes::Core::Types::int64, true>& v2)
{
r.comp = _mm_sub_epi64(v1.comp, v2.comp);
}
static FORCEINLINE void map(Phanes::Core::Math::TIntVector2<Phanes::Core::Types::int64, true>& r, const Phanes::Core::Math::TIntVector2<Phanes::Core::Types::int64, true>& v1, T s)
{
r.comp = _mm_sub_epi64(v1.comp, _mm_set1_epi64x(s));
}
};
template<>
struct compute_ivec2_inc<Phanes::Core::Types::int64, true>
{
static FORCEINLINE void map(Phanes::Core::Math::TIntVector2<Phanes::Core::Types::int64, true>& r, const Phanes::Core::Math::TIntVector2<Phanes::Core::Types::int64, true>& v1)
{
r.comp = _mm_add_epi64(v1.comp, _mm_set1_epi64x(1));
}
};
template<>
struct compute_ivec2_dec<Phanes::Core::Types::int64, true>
{
static FORCEINLINE void map(Phanes::Core::Math::TIntVector2<Phanes::Core::Types::int64, true>& r, const Phanes::Core::Math::TIntVector2<Phanes::Core::Types::int64, true>& v1)
{
r.comp = _mm_sub_epi64(v1.comp, _mm_set1_epi64x(1));
}
};
template<>
struct compute_ivec2_and<Phanes::Core::Types::int64, true>
{
static FORCEINLINE void map(Phanes::Core::Math::TIntVector2<Phanes::Core::Types::int64, true>& r, const Phanes::Core::Math::TIntVector2<Phanes::Core::Types::int64, true>& v1, const Phanes::Core::Math::TIntVector2<Phanes::Core::Types::int64, true>& v2)
{
r.comp = _mm_and_si128(v1.comp, v2.comp);
}
static FORCEINLINE void map(Phanes::Core::Math::TIntVector2<Phanes::Core::Types::int64, true>& r, const Phanes::Core::Math::TIntVector2<Phanes::Core::Types::int64, true>& v1, T s)
{
r.comp = _mm_and_si128(v1.comp, _mm_set1_epi64x(s));
}
};
template<>
struct compute_ivec2_or<Phanes::Core::Types::int64, true>
{
static FORCEINLINE void map(Phanes::Core::Math::TIntVector2<Phanes::Core::Types::int64, true>& r, const Phanes::Core::Math::TIntVector2<Phanes::Core::Types::int64, true>& v1, const Phanes::Core::Math::TIntVector2<Phanes::Core::Types::int64, true>& v2)
{
r.comp = _mm_or_si128(v1.comp, v2.comp);
}
static FORCEINLINE void map(Phanes::Core::Math::TIntVector2<Phanes::Core::Types::int64, true>& r, const Phanes::Core::Math::TIntVector2<Phanes::Core::Types::int64, true>& v1, T s)
{
r.comp = _mm_or_si128(v1.comp, _mm_set1_epi64x(s));
}
};
template<>
struct compute_ivec2_xor<Phanes::Core::Types::int64, true>
{
static FORCEINLINE void map(Phanes::Core::Math::TIntVector2<Phanes::Core::Types::int64, true>& r, const Phanes::Core::Math::TIntVector2<Phanes::Core::Types::int64, true>& v1, const Phanes::Core::Math::TIntVector2<Phanes::Core::Types::int64, true>& v2)
{
r.comp = _mm_xor_si128(v1.comp, v2.comp);
}
static FORCEINLINE void map(Phanes::Core::Math::TIntVector2<Phanes::Core::Types::int64, true>& r, const Phanes::Core::Math::TIntVector2<Phanes::Core::Types::int64, true>& v1, T s)
{
r.comp = _mm_xor_si128(v1.comp, _mm_set1_epi64x(s));
}
};
template<>
struct compute_ivec2_left_shift<Phanes::Core::Types::int64, true>
{
static FORCEINLINE void map(Phanes::Core::Math::TIntVector2<Phanes::Core::Types::int64, true>& r, const Phanes::Core::Math::TIntVector2<Phanes::Core::Types::int64, true>& v1, const Phanes::Core::Math::TIntVector2<Phanes::Core::Types::int64, true>& v2)
{
r.comp = _mm_sll_epi64(v1.comp, v2.comp);
}
static FORCEINLINE void map(Phanes::Core::Math::TIntVector2<Phanes::Core::Types::int64, true>& r, const Phanes::Core::Math::TIntVector2<Phanes::Core::Types::int64, true>& v1, T s)
{
r.comp = _mm_sll_epi64(v1.comp, _mm_set1_epi64x(s));
}
};
template<>
struct compute_ivec2_right_shift<Phanes::Core::Types::int64, true>
{
static FORCEINLINE void map(Phanes::Core::Math::TIntVector2<Phanes::Core::Types::int64, true>& r, const Phanes::Core::Math::TIntVector2<Phanes::Core::Types::int64, true>& v1, const Phanes::Core::Math::TIntVector2<Phanes::Core::Types::int64, true>& v2)
{
r.comp = _mm_srl_epi64(v1.comp, v2.comp);
}
static FORCEINLINE void map(Phanes::Core::Math::TIntVector2<Phanes::Core::Types::int64, true>& r, const Phanes::Core::Math::TIntVector2<Phanes::Core::Types::int64, true>& v1, T s)
{
r.comp = _mm_srl_epi64(v1.comp, _mm_set1_epi64x(s));
}
};
}

View File

@ -7,10 +7,15 @@
#include "Core/public/Math/MathCommon.hpp"
// Required includes
#include "Core/public/Math/Vector2.hpp"
#include "Core/public/Math/Vector3.hpp"
#include "Core/public/Math/Vector4.hpp"
#include "Core/public/Math/IntVector2.hpp"
#include "Core/public/Math/IntVector3.hpp"
#include "Core/public/Math/IntVector4.hpp"
// ========== //
// Common //
// ========== //
@ -576,7 +581,7 @@ namespace Phanes::Core::Math::Detail
{
static FORCEINLINE void map(Phanes::Core::Math::TIntVector2<Phanes::Core::Types::int64, true>& v1, const TIntVector2<Phanes::Core::Types::int64, true>& v2)
{
v1.comp = _mm_setr_epi64x(v2.x, v2.y);
v1.comp = _mm_set_epi64x(v2.y, v2.x);
}
@ -587,7 +592,7 @@ namespace Phanes::Core::Math::Detail
static FORCEINLINE void map(Phanes::Core::Math::TIntVector2<Phanes::Core::Types::int64, true>& v1, Phanes::Core::Types::int64 x, Phanes::Core::Types::int64 y)
{
v1.comp = _mm_setr_epi64x(x, y);
v1.comp = _mm_set_epi64x(y, x);
}
@ -605,7 +610,7 @@ namespace Phanes::Core::Math::Detail
r.comp = _mm_add_epi64(v1.comp, v2.comp);
}
static FORCEINLINE void map(Phanes::Core::Math::TIntVector2<Phanes::Core::Types::int64, true>& r, const Phanes::Core::Math::TIntVector2<Phanes::Core::Types::int64, true>& v1, T s)
static FORCEINLINE void map(Phanes::Core::Math::TIntVector2<Phanes::Core::Types::int64, true>& r, const Phanes::Core::Math::TIntVector2<Phanes::Core::Types::int64, true>& v1, Phanes::Core::Types::int64 s)
{
r.comp = _mm_add_epi64(v1.comp, _mm_set1_epi64x(s));
}
@ -619,7 +624,7 @@ namespace Phanes::Core::Math::Detail
r.comp = _mm_sub_epi64(v1.comp, v2.comp);
}
static FORCEINLINE void map(Phanes::Core::Math::TIntVector2<Phanes::Core::Types::int64, true>& r, const Phanes::Core::Math::TIntVector2<Phanes::Core::Types::int64, true>& v1, T s)
static FORCEINLINE void map(Phanes::Core::Math::TIntVector2<Phanes::Core::Types::int64, true>& r, const Phanes::Core::Math::TIntVector2<Phanes::Core::Types::int64, true>& v1, Phanes::Core::Types::int64 s)
{
r.comp = _mm_sub_epi64(v1.comp, _mm_set1_epi64x(s));
}
@ -651,7 +656,7 @@ namespace Phanes::Core::Math::Detail
r.comp = _mm_and_si128(v1.comp, v2.comp);
}
static FORCEINLINE void map(Phanes::Core::Math::TIntVector2<Phanes::Core::Types::int64, true>& r, const Phanes::Core::Math::TIntVector2<Phanes::Core::Types::int64, true>& v1, T s)
static FORCEINLINE void map(Phanes::Core::Math::TIntVector2<Phanes::Core::Types::int64, true>& r, const Phanes::Core::Math::TIntVector2<Phanes::Core::Types::int64, true>& v1, Phanes::Core::Types::int64 s)
{
r.comp = _mm_and_si128(v1.comp, _mm_set1_epi64x(s));
}
@ -665,7 +670,7 @@ namespace Phanes::Core::Math::Detail
r.comp = _mm_or_si128(v1.comp, v2.comp);
}
static FORCEINLINE void map(Phanes::Core::Math::TIntVector2<Phanes::Core::Types::int64, true>& r, const Phanes::Core::Math::TIntVector2<Phanes::Core::Types::int64, true>& v1, T s)
static FORCEINLINE void map(Phanes::Core::Math::TIntVector2<Phanes::Core::Types::int64, true>& r, const Phanes::Core::Math::TIntVector2<Phanes::Core::Types::int64, true>& v1, Phanes::Core::Types::int64 s)
{
r.comp = _mm_or_si128(v1.comp, _mm_set1_epi64x(s));
}
@ -679,7 +684,7 @@ namespace Phanes::Core::Math::Detail
r.comp = _mm_xor_si128(v1.comp, v2.comp);
}
static FORCEINLINE void map(Phanes::Core::Math::TIntVector2<Phanes::Core::Types::int64, true>& r, const Phanes::Core::Math::TIntVector2<Phanes::Core::Types::int64, true>& v1, T s)
static FORCEINLINE void map(Phanes::Core::Math::TIntVector2<Phanes::Core::Types::int64, true>& r, const Phanes::Core::Math::TIntVector2<Phanes::Core::Types::int64, true>& v1, Phanes::Core::Types::int64 s)
{
r.comp = _mm_xor_si128(v1.comp, _mm_set1_epi64x(s));
}
@ -693,7 +698,7 @@ namespace Phanes::Core::Math::Detail
r.comp = _mm_sll_epi64(v1.comp, v2.comp);
}
static FORCEINLINE void map(Phanes::Core::Math::TIntVector2<Phanes::Core::Types::int64, true>& r, const Phanes::Core::Math::TIntVector2<Phanes::Core::Types::int64, true>& v1, T s)
static FORCEINLINE void map(Phanes::Core::Math::TIntVector2<Phanes::Core::Types::int64, true>& r, const Phanes::Core::Math::TIntVector2<Phanes::Core::Types::int64, true>& v1, Phanes::Core::Types::int64 s)
{
r.comp = _mm_sll_epi64(v1.comp, _mm_set1_epi64x(s));
}
@ -707,7 +712,7 @@ namespace Phanes::Core::Math::Detail
r.comp = _mm_srl_epi64(v1.comp, v2.comp);
}
static FORCEINLINE void map(Phanes::Core::Math::TIntVector2<Phanes::Core::Types::int64, true>& r, const Phanes::Core::Math::TIntVector2<Phanes::Core::Types::int64, true>& v1, T s)
static FORCEINLINE void map(Phanes::Core::Math::TIntVector2<Phanes::Core::Types::int64, true>& r, const Phanes::Core::Math::TIntVector2<Phanes::Core::Types::int64, true>& v1, Phanes::Core::Types::int64 s)
{
r.comp = _mm_srl_epi64(v1.comp, _mm_set1_epi64x(s));
}

View File

@ -11,7 +11,5 @@
# include "PhanesVectorMathSSE.hpp"
#elif P_INTRINSICS == P_INTRINSICS_NEON
# include "PhanesVectorMathNeon.hpp"
#elif P_INTRINSICS == P_INTRINSICS_FPU
# include "PhanesVectorMathFPU.hpp"
#endif

View File

@ -11,165 +11,165 @@
namespace Phanes::Core::Math
{
template<RealType T, bool A>
TVector2<T, A>::TVector2(const TVector2<Real, A>& v)
template<RealType T, bool S>
TVector2<T, S>::TVector2(const TVector2<Real, S>& v)
{
Detail::construct_vec2<T, SIMD::use_simd<T, 2, A>::value>::map(*this, v);
Detail::construct_vec2<T, S>::map(*this, v);
}
template<RealType T, bool A>
TVector2<T, A>::TVector2(Real _x, Real _y)
template<RealType T, bool S>
TVector2<T, S>::TVector2(Real _x, Real _y)
{
Detail::construct_vec2<T, SIMD::use_simd<T, 2, A>::value>::map(*this, _x, _y);
Detail::construct_vec2<T, S>::map(*this, _x, _y);
}
template<RealType T, bool A>
TVector2<T, A>::TVector2(Real s)
template<RealType T, bool S>
TVector2<T, S>::TVector2(Real s)
{
Detail::construct_vec2<T, SIMD::use_simd<T, 2, A>::value>::map(*this, s);
Detail::construct_vec2<T, S>::map(*this, s);
}
template<RealType T, bool A>
TVector2<T, A>::TVector2(const Real* comp)
template<RealType T, bool S>
TVector2<T, S>::TVector2(const Real* comp)
{
Detail::construct_vec2<T, SIMD::use_simd<T, 2, A>::value>::map(*this, comp);
Detail::construct_vec2<T, S>::map(*this, comp);
}
template<RealType T, bool A>
TVector2<T, A> operator+=(TVector2<T, A>& v1, const TVector2<T, A>& v2)
template<RealType T, bool S>
TVector2<T, S> operator+=(TVector2<T, S>& v1, const TVector2<T, S>& v2)
{
Detail::compute_vec2_add<T, SIMD::use_simd<T, 2, A>::value>::map(v1, v1, v2);
Detail::compute_vec2_add<T, S>::map(v1, v1, v2);
return v1;
}
template<RealType T, bool A>
TVector2<T, A> operator+=(TVector2<T, A>& v1, T s)
template<RealType T, bool S>
TVector2<T, S> operator+=(TVector2<T, S>& v1, T s)
{
Detail::compute_vec2_add<T, SIMD::use_simd<T, 2, A>::value>::map(v1, v1, s);
Detail::compute_vec2_add<T, S>::map(v1, v1, s);
return v1;
}
template<RealType T, bool A>
TVector2<T, A> operator-=(TVector2<T, A>& v1, const TVector2<T, A>& v2)
template<RealType T, bool S>
TVector2<T, S> operator-=(TVector2<T, S>& v1, const TVector2<T, S>& v2)
{
Detail::compute_vec2_sub<T, SIMD::use_simd<T, 2, A>::value>::map(v1, v1, v2);
Detail::compute_vec2_sub<T, S>::map(v1, v1, v2);
return v1;
}
template<RealType T, bool A>
TVector2<T, A> operator-=(TVector2<T, A>& v1, T s)
template<RealType T, bool S>
TVector2<T, S> operator-=(TVector2<T, S>& v1, T s)
{
Detail::compute_vec2_sub<T, SIMD::use_simd<T, 2, A>::value>::map(v1, v1, s);
Detail::compute_vec2_sub<T, S>::map(v1, v1, s);
return v1;
}
template<RealType T, bool A>
TVector2<T, A> operator*=(TVector2<T, A>& v1, const TVector2<T, A>& v2)
template<RealType T, bool S>
TVector2<T, S> operator*=(TVector2<T, S>& v1, const TVector2<T, S>& v2)
{
Detail::compute_vec2_mul<T, SIMD::use_simd<T, 2, A>::value>::map(v1, v1, v2);
Detail::compute_vec2_mul<T, S>::map(v1, v1, v2);
return v1;
}
template<RealType T, bool A>
TVector2<T, A> operator*=(TVector2<T, A>& v1, T s)
template<RealType T, bool S>
TVector2<T, S> operator*=(TVector2<T, S>& v1, T s)
{
Detail::compute_vec2_mul<T, SIMD::use_simd<T, 2, A>::value>::map(v1, v1, s);
Detail::compute_vec2_mul<T, S>::map(v1, v1, s);
return v1;
}
template<RealType T, bool A>
TVector2<T, A> operator/=(TVector2<T, A>& v1, const TVector2<T, A>& v2)
template<RealType T, bool S>
TVector2<T, S> operator/=(TVector2<T, S>& v1, const TVector2<T, S>& v2)
{
Detail::compute_vec2_div<T, SIMD::use_simd<T, 2, A>::value>::map(v1, v1, v2);
Detail::compute_vec2_div<T, S>::map(v1, v1, v2);
return v1;
}
template<RealType T, bool A>
TVector2<T, A> operator/=(TVector2<T, A>& v1, T s)
template<RealType T, bool S>
TVector2<T, S> operator/=(TVector2<T, S>& v1, T s)
{
Detail::compute_vec2_div<T, SIMD::use_simd<T, 2, A>::value>::map(v1, v1, s);
Detail::compute_vec2_div<T, S>::map(v1, v1, s);
return v1;
}
template<RealType T, bool A>
TVector2<T, A> operator+(TVector2<T, A>& v1, const TVector2<T, A>& v2)
template<RealType T, bool S>
TVector2<T, S> operator+(TVector2<T, S>& v1, const TVector2<T, S>& v2)
{
TVector2<T, A> r;
Detail::compute_vec2_add<T, SIMD::use_simd<T, 2, A>::value>::map(r, v1, v2);
TVector2<T, S> r;
Detail::compute_vec2_add<T, S>::map(r, v1, v2);
return r;
}
template<RealType T, bool A>
TVector2<T, A> operator+(TVector2<T, A>& v1, T s)
template<RealType T, bool S>
TVector2<T, S> operator+(TVector2<T, S>& v1, T s)
{
TVector2<T, A> r;
Detail::compute_vec2_add<T, SIMD::use_simd<T, 2, A>::value>::map(r, v1, s);
TVector2<T, S> r;
Detail::compute_vec2_add<T, S>::map(r, v1, s);
return r;
}
template<RealType T, bool A>
TVector2<T, A> operator-(TVector2<T, A>& v1, const TVector2<T, A>& v2)
template<RealType T, bool S>
TVector2<T, S> operator-(TVector2<T, S>& v1, const TVector2<T, S>& v2)
{
TVector2<T, A> r;
Detail::compute_vec2_sub<T, SIMD::use_simd<T, 2, A>::value>::map(r, v1, v2);
TVector2<T, S> r;
Detail::compute_vec2_sub<T, S>::map(r, v1, v2);
return r;
}
template<RealType T, bool A>
TVector2<T, A> operator-(TVector2<T, A>& v1, T s)
template<RealType T, bool S>
TVector2<T, S> operator-(TVector2<T, S>& v1, T s)
{
TVector2<T, A> r;
Detail::compute_vec2_sub<T, SIMD::use_simd<T, 2, A>::value>::map(r, v1, s);
TVector2<T, S> r;
Detail::compute_vec2_sub<T, S>::map(r, v1, s);
return r;
}
template<RealType T, bool A>
TVector2<T, A> operator*(TVector2<T, A>& v1, const TVector2<T, A>& v2)
template<RealType T, bool S>
TVector2<T, S> operator*(TVector2<T, S>& v1, const TVector2<T, S>& v2)
{
TVector2<T, A> r;
Detail::compute_vec2_mul<T, SIMD::use_simd<T, 2, A>::value>::map(r, v1, v2);
TVector2<T, S> r;
Detail::compute_vec2_mul<T, S>::map(r, v1, v2);
return r;
}
template<RealType T, bool A>
TVector2<T, A> operator*(TVector2<T, A>& v1, T s)
template<RealType T, bool S>
TVector2<T, S> operator*(TVector2<T, S>& v1, T s)
{
TVector2<T, A> r;
Detail::compute_vec2_mul<T, SIMD::use_simd<T, 2, A>::value>::map(r, v1, s);
TVector2<T, S> r;
Detail::compute_vec2_mul<T, S>::map(r, v1, s);
return r;
}
template<RealType T, bool A>
TVector2<T, A> operator/(TVector2<T, A>& v1, const TVector2<T, A>& v2)
template<RealType T, bool S>
TVector2<T, S> operator/(TVector2<T, S>& v1, const TVector2<T, S>& v2)
{
TVector2<T, A> r;
Detail::compute_vec2_div<T, SIMD::use_simd<T, 2, A>::value>::map(r, v1, v2);
TVector2<T, S> r;
Detail::compute_vec2_div<T, S>::map(r, v1, v2);
return r;
}
template<RealType T, bool A>
TVector2<T, A> operator/(TVector2<T, A>& v1, T s)
template<RealType T, bool S>
TVector2<T, S> operator/(TVector2<T, S>& v1, T s)
{
TVector2<T, A> r;
Detail::compute_vec2_div<T, SIMD::use_simd<T, 2, A>::value>::map(r, v1, s);
TVector2<T, S> r;
Detail::compute_vec2_div<T, S>::map(r, v1, s);
return r;
}
// Comparision
template<RealType T, bool A>
bool operator==(const TVector2<T, A>& v1, const TVector2<T, A>& v2)
template<RealType T, bool S>
bool operator==(const TVector2<T, S>& v1, const TVector2<T, S>& v2)
{
return Detail::compute_vec2_eq<T, SIMD::use_simd<T, 2, A>::value>::map(v1, v2);
return Detail::compute_vec2_eq<T, S>::map(v1, v2);
}
template<RealType T, bool A>
bool operator!=(const TVector2<T, A>& v1, const TVector2<T, A>& v2)
template<RealType T, bool S>
bool operator!=(const TVector2<T, S>& v1, const TVector2<T, S>& v2)
{
return Detail::compute_vec2_ieq<T, SIMD::use_simd<T, 2, A>::value>::map(v1, v2);
return Detail::compute_vec2_ieq<T, S>::map(v1, v2);
}
@ -177,28 +177,28 @@ namespace Phanes::Core::Math
// Inc- / Decrement
template<RealType T, bool A>
TVector2<T, A>& operator++(TVector2<T, A>& v1)
template<RealType T, bool S>
TVector2<T, S>& operator++(TVector2<T, S>& v1)
{
Detail::compute_vec2_inc<T, SIMD::use_simd<T, 2, A>::value>::map(v1);
Detail::compute_vec2_inc<T, S>::map(v1);
return v1;
}
template<RealType T, bool A>
TVector2<T, A>& operator--(TVector2<T, A>& v1)
template<RealType T, bool S>
TVector2<T, S>& operator--(TVector2<T, S>& v1)
{
Detail::compute_vec2_inc<T, SIMD::use_simd<T, 2, A>::value>::map(v1);
Detail::compute_vec2_inc<T, S>::map(v1);
return v1;
}
template<RealType T, bool A>
TVector2<T, A>& operator++(TVector2<T, A>& v1, int)
template<RealType T, bool S>
TVector2<T, S>& operator++(TVector2<T, S>& v1, int)
{
return ++v1;
}
template<RealType T, bool A>
TVector2<T, A>& operator--(TVector2<T, A>& v1, int)
template<RealType T, bool S>
TVector2<T, S>& operator--(TVector2<T, S>& v1, int)
{
return --v1;
}

View File

@ -11,171 +11,171 @@
namespace Phanes::Core::Math
{
template<RealType T, bool A>
TVector3<T, A>::TVector3(const TVector3<Real, A>& v)
template<RealType T, bool S>
TVector3<T, S>::TVector3(const TVector3<Real, S>& v)
{
Detail::construct_vec3<T, SIMD::use_simd<T, 3, A>::value>::map(*this, v);
Detail::construct_vec3<T, S>::map(*this, v);
}
template<RealType T, bool A>
TVector3<T, A>::TVector3(Real _x, Real _y, Real _z)
template<RealType T, bool S>
TVector3<T, S>::TVector3(Real _x, Real _y, Real _z)
{
Detail::construct_vec3<T, SIMD::use_simd<T, 3, A>::value>::map(*this, _x, _y, _z);
Detail::construct_vec3<T, S>::map(*this, _x, _y, _z);
}
template<RealType T, bool A>
TVector3<T, A>::TVector3(Real s)
template<RealType T, bool S>
TVector3<T, S>::TVector3(Real s)
{
Detail::construct_vec3<T, SIMD::use_simd<T, 3, A>::value>::map(*this, s);
Detail::construct_vec3<T, S>::map(*this, s);
}
template<RealType T, bool A>
TVector3<T, A>::TVector3(const TVector2<Real, A>& v1, Real s)
template<RealType T, bool S>
TVector3<T, S>::TVector3(const TVector2<Real, S>& v1, Real s)
{
Detail::construct_vec3<T, SIMD::use_simd<T, 3, A>::value>::map(*this, v1, s);
Detail::construct_vec3<T, S>::map(*this, v1, s);
}
template<RealType T, bool A>
TVector3<T, A>::TVector3(const Real* comp)
template<RealType T, bool S>
TVector3<T, S>::TVector3(const Real* comp)
{
Detail::construct_vec3<T, SIMD::use_simd<T, 3, A>::value>::map(*this, comp);
Detail::construct_vec3<T, S>::map(*this, comp);
}
template<RealType T, bool A>
TVector3<T, A> operator+=(TVector3<T, A>& v1, const TVector3<T, A>& v2)
template<RealType T, bool S>
TVector3<T, S> operator+=(TVector3<T, S>& v1, const TVector3<T, S>& v2)
{
Detail::compute_vec3_add<T, SIMD::use_simd<T, 3, A>::value>::map(v1, v1, v2);
Detail::compute_vec3_add<T, S>::map(v1, v1, v2);
return v1;
}
template<RealType T, bool A>
TVector3<T, A> operator+=(TVector3<T, A>& v1, T s)
template<RealType T, bool S>
TVector3<T, S> operator+=(TVector3<T, S>& v1, T s)
{
Detail::compute_vec3_add<T, SIMD::use_simd<T, 3, A>::value>::map(v1, v1, s);
Detail::compute_vec3_add<T, S>::map(v1, v1, s);
return v1;
}
template<RealType T, bool A>
TVector3<T, A> operator-=(TVector3<T, A>& v1, const TVector3<T, A>& v2)
template<RealType T, bool S>
TVector3<T, S> operator-=(TVector3<T, S>& v1, const TVector3<T, S>& v2)
{
Detail::compute_vec3_sub<T, SIMD::use_simd<T, 3, A>::value>::map(v1, v1, v2);
Detail::compute_vec3_sub<T, S>::map(v1, v1, v2);
return v1;
}
template<RealType T, bool A>
TVector3<T, A> operator-=(TVector3<T, A>& v1, T s)
template<RealType T, bool S>
TVector3<T, S> operator-=(TVector3<T, S>& v1, T s)
{
Detail::compute_vec3_sub<T, SIMD::use_simd<T, 3, A>::value>::map(v1, v1, s);
Detail::compute_vec3_sub<T, S>::map(v1, v1, s);
return v1;
}
template<RealType T, bool A>
TVector3<T, A> operator*=(TVector3<T, A>& v1, const TVector3<T, A>& v2)
template<RealType T, bool S>
TVector3<T, S> operator*=(TVector3<T, S>& v1, const TVector3<T, S>& v2)
{
Detail::compute_vec3_mul<T, SIMD::use_simd<T, 3, A>::value>::map(v1, v1, v2);
Detail::compute_vec3_mul<T, S>::map(v1, v1, v2);
return v1;
}
template<RealType T, bool A>
TVector3<T, A> operator*=(TVector3<T, A>& v1, T s)
template<RealType T, bool S>
TVector3<T, S> operator*=(TVector3<T, S>& v1, T s)
{
Detail::compute_vec3_mul<T, SIMD::use_simd<T, 3, A>::value>::map(v1, v1, s);
Detail::compute_vec3_mul<T, S>::map(v1, v1, s);
return v1;
}
template<RealType T, bool A>
TVector3<T, A> operator/=(TVector3<T, A>& v1, const TVector3<T, A>& v2)
template<RealType T, bool S>
TVector3<T, S> operator/=(TVector3<T, S>& v1, const TVector3<T, S>& v2)
{
Detail::compute_vec3_div<T, SIMD::use_simd<T, 3, A>::value>::map(v1, v1, v2);
Detail::compute_vec3_div<T, S>::map(v1, v1, v2);
return v1;
}
template<RealType T, bool A>
TVector3<T, A> operator/=(TVector3<T, A>& v1, T s)
template<RealType T, bool S>
TVector3<T, S> operator/=(TVector3<T, S>& v1, T s)
{
Detail::compute_vec3_div<T, SIMD::use_simd<T, 3, A>::value>::map(v1, v1, s);
Detail::compute_vec3_div<T, S>::map(v1, v1, s);
return v1;
}
template<RealType T, bool A>
TVector3<T, A> operator+(TVector3<T, A>& v1, const TVector3<T, A>& v2)
template<RealType T, bool S>
TVector3<T, S> operator+(TVector3<T, S>& v1, const TVector3<T, S>& v2)
{
TVector3<T, A> r;
Detail::compute_vec3_add<T, SIMD::use_simd<T, 3, A>::value>::map(r, v1, v2);
TVector3<T, S> r;
Detail::compute_vec3_add<T, S>::map(r, v1, v2);
return r;
}
template<RealType T, bool A>
TVector3<T, A> operator+(TVector3<T, A>& v1, T s)
template<RealType T, bool S>
TVector3<T, S> operator+(TVector3<T, S>& v1, T s)
{
TVector3<T, A> r;
Detail::compute_vec3_add<T, SIMD::use_simd<T, 3, A>::value>::map(r, v1, s);
TVector3<T, S> r;
Detail::compute_vec3_add<T, S>::map(r, v1, s);
return r;
}
template<RealType T, bool A>
TVector3<T, A> operator-(TVector3<T, A>& v1, const TVector3<T, A>& v2)
template<RealType T, bool S>
TVector3<T, S> operator-(TVector3<T, S>& v1, const TVector3<T, S>& v2)
{
TVector3<T, A> r;
Detail::compute_vec3_sub<T, SIMD::use_simd<T, 3, A>::value>::map(r, v1, v2);
TVector3<T, S> r;
Detail::compute_vec3_sub<T, S>::map(r, v1, v2);
return r;
}
template<RealType T, bool A>
TVector3<T, A> operator-(TVector3<T, A>& v1, T s)
template<RealType T, bool S>
TVector3<T, S> operator-(TVector3<T, S>& v1, T s)
{
TVector3<T, A> r;
Detail::compute_vec3_sub<T, SIMD::use_simd<T, 3, A>::value>::map(r, v1, s);
TVector3<T, S> r;
Detail::compute_vec3_sub<T, S>::map(r, v1, s);
return r;
}
template<RealType T, bool A>
TVector3<T, A> operator*(TVector3<T, A>& v1, const TVector3<T, A>& v2)
template<RealType T, bool S>
TVector3<T, S> operator*(TVector3<T, S>& v1, const TVector3<T, S>& v2)
{
TVector3<T, A> r;
Detail::compute_vec3_mul<T, SIMD::use_simd<T, 3, A>::value>::map(r, v1, v2);
TVector3<T, S> r;
Detail::compute_vec3_mul<T, S>::map(r, v1, v2);
return r;
}
template<RealType T, bool A>
TVector3<T, A> operator*(TVector3<T, A>& v1, T s)
template<RealType T, bool S>
TVector3<T, S> operator*(TVector3<T, S>& v1, T s)
{
TVector3<T, A> r;
Detail::compute_vec3_mul<T, SIMD::use_simd<T, 3, A>::value>::map(r, v1, s);
TVector3<T, S> r;
Detail::compute_vec3_mul<T, S>::map(r, v1, s);
return r;
}
template<RealType T, bool A>
TVector3<T, A> operator/(TVector3<T, A>& v1, const TVector3<T, A>& v2)
template<RealType T, bool S>
TVector3<T, S> operator/(TVector3<T, S>& v1, const TVector3<T, S>& v2)
{
TVector3<T, A> r;
Detail::compute_vec3_div<T, SIMD::use_simd<T, 3, A>::value>::map(r, v1, v2);
TVector3<T, S> r;
Detail::compute_vec3_div<T, S>::map(r, v1, v2);
return r;
}
template<RealType T, bool A>
TVector3<T, A> operator/(TVector3<T, A>& v1, T s)
template<RealType T, bool S>
TVector3<T, S> operator/(TVector3<T, S>& v1, T s)
{
TVector3<T, A> r;
Detail::compute_vec3_div<T, SIMD::use_simd<T, 3, A>::value>::map(r, v1, s);
TVector3<T, S> r;
Detail::compute_vec3_div<T, S>::map(r, v1, s);
return r;
}
// Comparision
template<RealType T, bool A>
bool operator==(const TVector3<T, A>& v1, const TVector3<T, A>& v2)
template<RealType T, bool S>
bool operator==(const TVector3<T, S>& v1, const TVector3<T, S>& v2)
{
return Detail::compute_vec3_eq<T, SIMD::use_simd<T, 3, A>::value>::map(v1, v2);
return Detail::compute_vec3_eq<T, S>::map(v1, v2);
}
template<RealType T, bool A>
bool operator!=(const TVector3<T, A>& v1, const TVector3<T, A>& v2)
template<RealType T, bool S>
bool operator!=(const TVector3<T, S>& v1, const TVector3<T, S>& v2)
{
return Detail::compute_vec3_ieq<T, SIMD::use_simd<T, 3, A>::value>::map(v1, v2);
return Detail::compute_vec3_ieq<T, S>::map(v1, v2);
}
@ -183,28 +183,28 @@ namespace Phanes::Core::Math
// Inc- / Decrement
template<RealType T, bool A>
TVector3<T, A>& operator++(TVector3<T, A>& v1)
template<RealType T, bool S>
TVector3<T, S>& operator++(TVector3<T, S>& v1)
{
Detail::compute_vec3_inc<T, SIMD::use_simd<T, 3, A>::value>::map(v1);
Detail::compute_vec3_inc<T, S>::map(v1);
return v1;
}
template<RealType T, bool A>
TVector3<T, A>& operator--(TVector3<T, A>& v1)
template<RealType T, bool S>
TVector3<T, S>& operator--(TVector3<T, S>& v1)
{
Detail::compute_vec3_inc<T, SIMD::use_simd<T, 3, A>::value>::map(v1);
Detail::compute_vec3_inc<T, S>::map(v1);
return v1;
}
template<RealType T, bool A>
TVector3<T, A>& operator++(TVector3<T, A>& v1, int)
template<RealType T, bool S>
TVector3<T, S>& operator++(TVector3<T, S>& v1, int)
{
return ++v1;
}
template<RealType T, bool A>
TVector3<T, A>& operator--(TVector3<T, A>& v1, int)
template<RealType T, bool S>
TVector3<T, S>& operator--(TVector3<T, S>& v1, int)
{
return --v1;
}

View File

@ -10,169 +10,169 @@
namespace Phanes::Core::Math
{
template<RealType T, bool A>
TVector4<T, A>::TVector4(const TVector4<Real, A>& v)
template<RealType T, bool S>
TVector4<T, S>::TVector4(const TVector4<Real, S>& v)
{
Detail::construct_vec4<T, SIMD::use_simd<T, 4, A>::value>::map(*this, v);
Detail::construct_vec4<T, S>::map(*this, v);
}
template<RealType T, bool A>
TVector4<T, A>::TVector4(Real _x, Real _y, Real _z, Real _w)
template<RealType T, bool S>
TVector4<T, S>::TVector4(Real _x, Real _y, Real _z, Real _w)
{
Detail::construct_vec4<T, SIMD::use_simd<T, 4, A>::value>::map(*this, _x, _y, _z, _w);
Detail::construct_vec4<T, S>::map(*this, _x, _y, _z, _w);
}
template<RealType T, bool A>
Phanes::Core::Math::TVector4<T, A>::TVector4(Real s)
template<RealType T, bool S>
Phanes::Core::Math::TVector4<T, S>::TVector4(Real s)
{
Detail::construct_vec4<T, SIMD::use_simd<T, 4, A>::value>::map(*this, s);
Detail::construct_vec4<T, S>::map(*this, s);
}
template<RealType T, bool A>
Phanes::Core::Math::TVector4<T, A>::TVector4(const TVector2<Real, A>& v1, const TVector2<Real, A>& v2)
template<RealType T, bool S>
Phanes::Core::Math::TVector4<T, S>::TVector4(const TVector2<Real, S>& v1, const TVector2<Real, S>& v2)
{
Detail::construct_vec4<T, SIMD::use_simd<T, 4, A>::value>::map(*this, v1, v2);
Detail::construct_vec4<T, S>::map(*this, v1, v2);
}
template<RealType T, bool A>
Phanes::Core::Math::TVector4<T, A>::TVector4(const Real* comp)
template<RealType T, bool S>
Phanes::Core::Math::TVector4<T, S>::TVector4(const Real* comp)
{
Detail::construct_vec4<T, SIMD::use_simd<T, 4, A>::value>::map(*this, comp);
Detail::construct_vec4<T, S>::map(*this, comp);
}
template<RealType T, bool A>
TVector4<T, A> operator+=(TVector4<T, A>& v1, const TVector4<T, A>& v2)
template<RealType T, bool S>
TVector4<T, S> operator+=(TVector4<T, S>& v1, const TVector4<T, S>& v2)
{
Detail::compute_vec4_add<T, SIMD::use_simd<T, 4, A>::value>::map(v1, v1, v2);
Detail::compute_vec4_add<T, S>::map(v1, v1, v2);
return v1;
}
template<RealType T, bool A>
TVector4<T, A> operator+=(TVector4<T, A>& v1, T s)
template<RealType T, bool S>
TVector4<T, S> operator+=(TVector4<T, S>& v1, T s)
{
Detail::compute_vec4_add<T, SIMD::use_simd<T, 4, A>::value>::map(v1, v1, s);
Detail::compute_vec4_add<T, S>::map(v1, v1, s);
return v1;
}
template<RealType T, bool A>
TVector4<T, A> operator-=(TVector4<T, A>& v1, const TVector4<T, A>& v2)
template<RealType T, bool S>
TVector4<T, S> operator-=(TVector4<T, S>& v1, const TVector4<T, S>& v2)
{
Detail::compute_vec4_sub<T, SIMD::use_simd<T, 4, A>::value>::map(v1, v1, v2);
Detail::compute_vec4_sub<T, S>::map(v1, v1, v2);
return v1;
}
template<RealType T, bool A>
TVector4<T, A> operator-=(TVector4<T, A>& v1, T s)
template<RealType T, bool S>
TVector4<T, S> operator-=(TVector4<T, S>& v1, T s)
{
Detail::compute_vec4_sub<T, SIMD::use_simd<T, 4, A>::value>::map(v1, v1, s);
Detail::compute_vec4_sub<T, S>::map(v1, v1, s);
return v1;
}
template<RealType T, bool A>
TVector4<T, A> operator*=(TVector4<T, A>& v1, const TVector4<T, A>& v2)
template<RealType T, bool S>
TVector4<T, S> operator*=(TVector4<T, S>& v1, const TVector4<T, S>& v2)
{
Detail::compute_vec4_mul<T, SIMD::use_simd<T, 4, A>::value>::map(v1, v1, v2);
Detail::compute_vec4_mul<T, S>::map(v1, v1, v2);
return v1;
}
template<RealType T, bool A>
TVector4<T, A> operator*=(TVector4<T, A>& v1, T s)
template<RealType T, bool S>
TVector4<T, S> operator*=(TVector4<T, S>& v1, T s)
{
Detail::compute_vec4_mul<T, SIMD::use_simd<T, 4, A>::value>::map(v1, v1, s);
Detail::compute_vec4_mul<T, S>::map(v1, v1, s);
return v1;
}
template<RealType T, bool A>
TVector4<T, A> operator/=(TVector4<T, A>& v1, const TVector4<T, A>& v2)
template<RealType T, bool S>
TVector4<T, S> operator/=(TVector4<T, S>& v1, const TVector4<T, S>& v2)
{
Detail::compute_vec4_div<T, SIMD::use_simd<T, 4, A>::value>::map(v1, v1, v2);
Detail::compute_vec4_div<T, S>::map(v1, v1, v2);
return v1;
}
template<RealType T, bool A>
TVector4<T, A> operator/=(TVector4<T, A>& v1, T s)
template<RealType T, bool S>
TVector4<T, S> operator/=(TVector4<T, S>& v1, T s)
{
Detail::compute_vec4_div<T, SIMD::use_simd<T, 4, A>::value>::map(v1, v1, s);
Detail::compute_vec4_div<T, S>::map(v1, v1, s);
return v1;
}
template<RealType T, bool A>
TVector4<T, A> operator+(TVector4<T, A>& v1, const TVector4<T, A>& v2)
template<RealType T, bool S>
TVector4<T, S> operator+(TVector4<T, S>& v1, const TVector4<T, S>& v2)
{
TVector4<T, A> r;
Detail::compute_vec4_add<T, SIMD::use_simd<T, 4, A>::value>::map(r, v1, v2);
TVector4<T, S> r;
Detail::compute_vec4_add<T, S>::map(r, v1, v2);
return r;
}
template<RealType T, bool A>
TVector4<T, A> operator+(TVector4<T, A>& v1, T s)
template<RealType T, bool S>
TVector4<T, S> operator+(TVector4<T, S>& v1, T s)
{
TVector4<T, A> r;
Detail::compute_vec4_add<T, SIMD::use_simd<T, 4, A>::value>::map(r, v1, s);
TVector4<T, S> r;
Detail::compute_vec4_add<T, S>::map(r, v1, s);
return r;
}
template<RealType T, bool A>
TVector4<T, A> operator-(TVector4<T, A>& v1, const TVector4<T, A>& v2)
template<RealType T, bool S>
TVector4<T, S> operator-(TVector4<T, S>& v1, const TVector4<T, S>& v2)
{
TVector4<T, A> r;
Detail::compute_vec4_sub<T, SIMD::use_simd<T, 4, A>::value>::map(r, v1, v2);
TVector4<T, S> r;
Detail::compute_vec4_sub<T, S>::map(r, v1, v2);
return r;
}
template<RealType T, bool A>
TVector4<T, A> operator-(TVector4<T, A>& v1, T s)
template<RealType T, bool S>
TVector4<T, S> operator-(TVector4<T, S>& v1, T s)
{
TVector4<T, A> r;
Detail::compute_vec4_sub<T, SIMD::use_simd<T, 4, A>::value>::map(r, v1, s);
TVector4<T, S> r;
Detail::compute_vec4_sub<T, S>::map(r, v1, s);
return r;
}
template<RealType T, bool A>
TVector4<T, A> operator*(TVector4<T, A>& v1, const TVector4<T, A>& v2)
template<RealType T, bool S>
TVector4<T, S> operator*(TVector4<T, S>& v1, const TVector4<T, S>& v2)
{
TVector4<T, A> r;
Detail::compute_vec4_mul<T, SIMD::use_simd<T, 4, A>::value>::map(r, v1, v2);
TVector4<T, S> r;
Detail::compute_vec4_mul<T, S>::map(r, v1, v2);
return r;
}
template<RealType T, bool A>
TVector4<T, A> operator*(TVector4<T, A>& v1, T s)
template<RealType T, bool S>
TVector4<T, S> operator*(TVector4<T, S>& v1, T s)
{
TVector4<T, A> r;
Detail::compute_vec4_mul<T, SIMD::use_simd<T, 4, A>::value>::map(r, v1, s);
TVector4<T, S> r;
Detail::compute_vec4_mul<T, S>::map(r, v1, s);
return r;
}
template<RealType T, bool A>
TVector4<T, A> operator/(TVector4<T, A>& v1, const TVector4<T, A>& v2)
template<RealType T, bool S>
TVector4<T, S> operator/(TVector4<T, S>& v1, const TVector4<T, S>& v2)
{
TVector4<T, A> r;
Detail::compute_vec4_div<T, SIMD::use_simd<T, 4, A>::value>::map(r, v1, v2);
TVector4<T, S> r;
Detail::compute_vec4_div<T, S>::map(r, v1, v2);
return r;
}
template<RealType T, bool A>
TVector4<T, A> operator/(TVector4<T, A>& v1, T s)
template<RealType T, bool S>
TVector4<T, S> operator/(TVector4<T, S>& v1, T s)
{
TVector4<T, A> r;
Detail::compute_vec4_div<T, SIMD::use_simd<T, 4, A>::value>::map(r, v1, s);
TVector4<T, S> r;
Detail::compute_vec4_div<T, S>::map(r, v1, s);
return r;
}
// Comparision
template<RealType T, bool A>
bool operator==(const TVector4<T, A>& v1, const TVector4<T, A>& v2)
template<RealType T, bool S>
bool operator==(const TVector4<T, S>& v1, const TVector4<T, S>& v2)
{
return Detail::compute_vec4_eq<T, SIMD::use_simd<T, 4, A>::value>::map(v1, v2);
return Detail::compute_vec4_eq<T, S>::map(v1, v2);
}
template<RealType T, bool A>
bool operator!=(const TVector4<T, A>& v1, const TVector4<T, A>& v2)
template<RealType T, bool S>
bool operator!=(const TVector4<T, S>& v1, const TVector4<T, S>& v2)
{
return Detail::compute_vec4_ieq<T, SIMD::use_simd<T, 4, A>::value>::map(v1, v2);
return Detail::compute_vec4_ieq<T, S>::map(v1, v2);
}
@ -180,28 +180,28 @@ namespace Phanes::Core::Math
// Inc- / Decrement
template<RealType T, bool A>
TVector4<T, A>& operator++(TVector4<T, A>& v1)
template<RealType T, bool S>
TVector4<T, S>& operator++(TVector4<T, S>& v1)
{
Detail::compute_vec4_inc<T, SIMD::use_simd<T, 4, A>::value>::map(v1);
Detail::compute_vec4_inc<T, S>::map(v1);
return v1;
}
template<RealType T, bool A>
TVector4<T, A>& operator--(TVector4<T, A>& v1)
template<RealType T, bool S>
TVector4<T, S>& operator--(TVector4<T, S>& v1)
{
Detail::compute_vec4_dec<T, SIMD::use_simd<T, 4, A>::value>::map(v1);
Detail::compute_vec4_dec<T, S>::map(v1);
return v1;
}
template<RealType T, bool A>
TVector4<T, A>& operator++(TVector4<T, A>& v1, int)
template<RealType T, bool S>
TVector4<T, S>& operator++(TVector4<T, S>& v1, int)
{
return ++v1;
}
template<RealType T, bool A>
TVector4<T, A>& operator--(TVector4<T, A>& v1, int)
template<RealType T, bool S>
TVector4<T, S>& operator--(TVector4<T, S>& v1, int)
{
return --v1;
}