This commit is contained in:
christophe
2025-10-21 14:45:13 -06:00
committed by Christophe
parent a97b747110
commit 745a96db47
3 changed files with 28 additions and 86 deletions

View File

@@ -7,95 +7,47 @@ namespace glm {
namespace detail
{
template<length_t L, typename T, qualifier Q, bool UseSimd>
struct compute_vec_add {};
template<length_t L, typename T, qualifier Q, bool UseSimd>
struct compute_vec_sub {};
template<length_t L, typename T, qualifier Q, bool UseSimd>
struct compute_vec_mul {};
template<length_t L, typename T, qualifier Q, bool UseSimd>
struct compute_vec_div {};
template<length_t L, typename T, qualifier Q, bool UseSimd>
struct compute_vec_mod {};
template<length_t L, typename T, qualifier Q, bool UseSimd>
struct compute_splat {};
template<length_t L, typename T, qualifier Q, int IsInt, std::size_t Size, bool UseSimd>
struct compute_vec_and {};
template<length_t L, typename T, qualifier Q, int IsInt, std::size_t Size, bool UseSimd>
struct compute_vec_or {};
template<length_t L, typename T, qualifier Q, int IsInt, std::size_t Size, bool UseSimd>
struct compute_vec_xor {};
template<length_t L, typename T, qualifier Q, int IsInt, std::size_t Size, bool UseSimd>
struct compute_vec_shift_left {};
template<length_t L, typename T, qualifier Q, int IsInt, std::size_t Size, bool UseSimd>
struct compute_vec_shift_right {};
template<length_t L, typename T, qualifier Q, int IsInt, std::size_t Size, bool UseSimd>
struct compute_vec_equal {};
template<length_t L, typename T, qualifier Q, int IsInt, std::size_t Size, bool UseSimd>
struct compute_vec_nequal {};
template<length_t L, typename T, qualifier Q, int IsInt, std::size_t Size, bool UseSimd>
struct compute_vec_bitwise_not {};
template<length_t L, typename T, qualifier Q>
struct compute_vec_add<L, T, Q, false>
{
struct compute_vec_add {
GLM_FUNC_QUALIFIER GLM_CONSTEXPR static vec<L, T, Q> call(vec<L, T, Q> const& a, vec<L, T, Q> const& b)
{
return detail::functor2<vec, L, T, Q>::call(std::plus<T>(), a, b);
}
};
template<length_t L, typename T, qualifier Q>
struct compute_vec_sub<L, T, Q, false>
{
template<length_t L, typename T, qualifier Q, bool UseSimd>
struct compute_vec_sub {
GLM_FUNC_QUALIFIER GLM_CONSTEXPR static vec<L, T, Q> call(vec<L, T, Q> const& a, vec<L, T, Q> const& b)
{
return detail::functor2<vec, L, T, Q>::call(std::minus<T>(), a, b);
}
};
template<length_t L, typename T, qualifier Q>
struct compute_vec_mul<L, T, Q, false>
{
template<length_t L, typename T, qualifier Q, bool UseSimd>
struct compute_vec_mul {
GLM_FUNC_QUALIFIER GLM_CONSTEXPR static vec<L, T, Q> call(vec<L, T, Q> const& a, vec<L, T, Q> const& b)
{
return detail::functor2<vec, L, T, Q>::call(std::multiplies<T>(), a, b);
}
};
template<length_t L, typename T, qualifier Q>
struct compute_vec_div<L, T, Q, false>
{
template<length_t L, typename T, qualifier Q, bool UseSimd>
struct compute_vec_div {
GLM_FUNC_QUALIFIER GLM_CONSTEXPR static vec<L, T, Q> call(vec<L, T, Q> const& a, vec<L, T, Q> const& b)
{
return detail::functor2<vec, L, T, Q>::call(std::divides<T>(), a, b);
}
};
template<length_t L, typename T, qualifier Q>
struct compute_vec_mod<L, T, Q, false>
{
template<length_t L, typename T, qualifier Q, bool UseSimd>
struct compute_vec_mod {
GLM_FUNC_QUALIFIER GLM_CONSTEXPR static vec<L, T, Q> call(vec<L, T, Q> const& a, vec<L, T, Q> const& b)
{
return detail::functor2<vec, L, T, Q>::call(std::modulus<T>(), a, b);
}
};
template<length_t L, typename T, qualifier Q, int IsInt, std::size_t Size>
struct compute_vec_and<L, T, Q, IsInt, Size, false>
{
template<length_t L, typename T, qualifier Q, int IsInt, std::size_t Size, bool UseSimd>
struct compute_vec_and {
GLM_FUNC_QUALIFIER GLM_CONSTEXPR static vec<L, T, Q> call(vec<L, T, Q> const& a, vec<L, T, Q> const& b)
{
vec<L, T, Q> v(a);
@@ -105,9 +57,8 @@ namespace glm {
}
};
template<length_t L, typename T, qualifier Q, int IsInt, std::size_t Size>
struct compute_vec_or<L, T, Q, IsInt, Size, false>
{
template<length_t L, typename T, qualifier Q, int IsInt, std::size_t Size, bool UseSimd>
struct compute_vec_or {
GLM_FUNC_QUALIFIER GLM_CONSTEXPR static vec<L, T, Q> call(vec<L, T, Q> const& a, vec<L, T, Q> const& b)
{
vec<L, T, Q> v(a);
@@ -117,9 +68,8 @@ namespace glm {
}
};
template<length_t L, typename T, qualifier Q, int IsInt, std::size_t Size>
struct compute_vec_xor<L, T, Q, IsInt, Size, false>
{
template<length_t L, typename T, qualifier Q, int IsInt, std::size_t Size, bool UseSimd>
struct compute_vec_xor {
GLM_FUNC_QUALIFIER GLM_CONSTEXPR static vec<L, T, Q> call(vec<L, T, Q> const& a, vec<L, T, Q> const& b)
{
vec<L, T, Q> v(a);
@@ -129,9 +79,8 @@ namespace glm {
}
};
template<length_t L, typename T, qualifier Q, int IsInt, std::size_t Size>
struct compute_vec_shift_left<L, T, Q, IsInt, Size, false>
{
template<length_t L, typename T, qualifier Q, int IsInt, std::size_t Size, bool UseSimd>
struct compute_vec_shift_left {
GLM_FUNC_QUALIFIER GLM_CONSTEXPR static vec<L, T, Q> call(vec<L, T, Q> const& a, vec<L, T, Q> const& b)
{
vec<L, T, Q> v(a);
@@ -141,9 +90,8 @@ namespace glm {
}
};
template<length_t L, typename T, qualifier Q, int IsInt, std::size_t Size>
struct compute_vec_shift_right<L, T, Q, IsInt, Size, false>
{
template<length_t L, typename T, qualifier Q, int IsInt, std::size_t Size, bool UseSimd>
struct compute_vec_shift_right {
GLM_FUNC_QUALIFIER GLM_CONSTEXPR static vec<L, T, Q> call(vec<L, T, Q> const& a, vec<L, T, Q> const& b)
{
vec<L, T, Q> v(a);
@@ -153,9 +101,8 @@ namespace glm {
}
};
template<length_t L, typename T, qualifier Q, int IsInt, std::size_t Size>
struct compute_vec_equal<L, T, Q, IsInt, Size, false>
{
template<length_t L, typename T, qualifier Q, int IsInt, std::size_t Size, bool UseSimd>
struct compute_vec_equal {
GLM_FUNC_QUALIFIER GLM_CONSTEXPR static bool call(vec<L, T, Q> const& v1, vec<L, T, Q> const& v2)
{
bool b = true;
@@ -165,18 +112,16 @@ namespace glm {
}
};
template<length_t L, typename T, qualifier Q, int IsInt, std::size_t Size>
struct compute_vec_nequal<L, T, Q, IsInt, Size, false>
{
template<length_t L, typename T, qualifier Q, int IsInt, std::size_t Size, bool UseSimd>
struct compute_vec_nequal {
GLM_FUNC_QUALIFIER GLM_CONSTEXPR static bool call(vec<4, T, Q> const& v1, vec<4, T, Q> const& v2)
{
return !compute_vec_equal<L, T, Q, detail::is_int<T>::value, sizeof(T) * 8, detail::is_aligned<Q>::value>::call(v1, v2);
}
};
template<length_t L, typename T, qualifier Q, int IsInt, std::size_t Size>
struct compute_vec_bitwise_not<L, T, Q, IsInt, Size, false>
{
template<length_t L, typename T, qualifier Q, int IsInt, std::size_t Size, bool UseSimd>
struct compute_vec_bitwise_not {
GLM_FUNC_QUALIFIER GLM_CONSTEXPR static vec<L, T, Q> call(vec<L, T, Q> const& a)
{
vec<L, T, Q> v(a);
@@ -185,6 +130,5 @@ namespace glm {
return v;
}
};
}
}

View File

@@ -10,6 +10,7 @@
#include "../ext/scalar_int_sized.hpp"
#include "../ext/scalar_uint_sized.hpp"
#include "../glm.hpp"
#include "../ext.hpp"
namespace glm
{

View File

@@ -252,9 +252,6 @@
#include "./gtx/vector_angle.hpp"
#include "./gtx/vector_query.hpp"
#include "./gtx/wrap.hpp"
#if GLM_HAS_TEMPLATE_ALIASES
#include "./gtx/scalar_multiplication.hpp"
#endif
#include "./gtx/range.hpp"
#endif//GLM_ENABLE_EXPERIMENTAL