Use length_t instead of int for vec and mat lengths #584
This commit is contained in:
@@ -344,7 +344,7 @@ namespace clamp_
|
||||
|
||||
namespace mix_
|
||||
{
|
||||
template <typename T, typename B>
|
||||
template<typename T, typename B>
|
||||
struct entry
|
||||
{
|
||||
T x;
|
||||
@@ -514,7 +514,7 @@ namespace mix_
|
||||
|
||||
namespace step_
|
||||
{
|
||||
template <typename EDGE, typename VEC>
|
||||
template<typename EDGE, typename VEC>
|
||||
struct entry
|
||||
{
|
||||
EDGE edge;
|
||||
@@ -817,7 +817,7 @@ namespace isinf_
|
||||
|
||||
namespace sign
|
||||
{
|
||||
template <typename genFIType>
|
||||
template<typename genFIType>
|
||||
GLM_FUNC_QUALIFIER genFIType sign_if(genFIType x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(
|
||||
@@ -834,7 +834,7 @@ namespace sign
|
||||
return result;
|
||||
}
|
||||
|
||||
template <typename genFIType>
|
||||
template<typename genFIType>
|
||||
GLM_FUNC_QUALIFIER genFIType sign_alu1(genFIType x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(
|
||||
@@ -844,7 +844,7 @@ namespace sign
|
||||
return (x >> 31) | ((unsigned)-x >> 31);
|
||||
}
|
||||
|
||||
template <typename genFIType>
|
||||
template<typename genFIType>
|
||||
GLM_FUNC_QUALIFIER genFIType sign_alu2(genFIType x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(
|
||||
@@ -854,7 +854,7 @@ namespace sign
|
||||
return -((unsigned)x >> 31) | (-(unsigned)x >> 31);
|
||||
}
|
||||
|
||||
template <typename genFIType>
|
||||
template<typename genFIType>
|
||||
GLM_FUNC_QUALIFIER genFIType sign_sub(genFIType x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(
|
||||
@@ -864,7 +864,7 @@ namespace sign
|
||||
return ((unsigned)-x >> 31) - ((unsigned)x >> 31);
|
||||
}
|
||||
|
||||
template <typename genFIType>
|
||||
template<typename genFIType>
|
||||
GLM_FUNC_QUALIFIER genFIType sign_cmp(genFIType x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(
|
||||
@@ -874,7 +874,7 @@ namespace sign
|
||||
return (x > 0) - (x < 0);
|
||||
}
|
||||
|
||||
template <typename genType>
|
||||
template<typename genType>
|
||||
struct type
|
||||
{
|
||||
genType Value;
|
||||
|
||||
@@ -15,7 +15,7 @@ enum result
|
||||
|
||||
namespace bitfieldInsert
|
||||
{
|
||||
template <typename genType, typename sizeType>
|
||||
template<typename genType, typename sizeType>
|
||||
struct type
|
||||
{
|
||||
genType Base;
|
||||
@@ -59,7 +59,7 @@ namespace bitfieldInsert
|
||||
|
||||
namespace bitfieldExtract
|
||||
{
|
||||
template <typename genType, typename sizeType>
|
||||
template<typename genType, typename sizeType>
|
||||
struct type
|
||||
{
|
||||
genType Value;
|
||||
@@ -151,23 +151,23 @@ namespace bitfieldReverse
|
||||
return Result;
|
||||
}
|
||||
*/
|
||||
template <int D, typename T, glm::precision P, template <int, typename, glm::precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, T, P> bitfieldReverseLoop(vecType<D, T, P> const & v)
|
||||
template<glm::length_t L, typename T, glm::precision P, template<glm::length_t, typename, glm::precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> bitfieldReverseLoop(vecType<L, T, P> const & v)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_integer, "'bitfieldReverse' only accept integer values");
|
||||
|
||||
vecType<D, T, P> Result(0);
|
||||
vecType<L, T, P> Result(0);
|
||||
T const BitSize = static_cast<T>(sizeof(T) * 8);
|
||||
for(T i = 0; i < BitSize; ++i)
|
||||
{
|
||||
vecType<D, T, P> const BitSet(v & (static_cast<T>(1) << i));
|
||||
vecType<D, T, P> const BitFirst(BitSet >> i);
|
||||
vecType<L, T, P> const BitSet(v & (static_cast<T>(1) << i));
|
||||
vecType<L, T, P> const BitFirst(BitSet >> i);
|
||||
Result |= BitFirst << (BitSize - 1 - i);
|
||||
}
|
||||
return Result;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
template<typename T>
|
||||
GLM_FUNC_QUALIFIER T bitfieldReverseLoop(T v)
|
||||
{
|
||||
return bitfieldReverseLoop(glm::vec<1, T>(v)).x;
|
||||
@@ -194,30 +194,30 @@ namespace bitfieldReverse
|
||||
return x;
|
||||
}
|
||||
|
||||
template <bool EXEC = false>
|
||||
template<bool EXEC = false>
|
||||
struct compute_bitfieldReverseStep
|
||||
{
|
||||
template <int D, typename T, glm::precision P, template <int, typename, glm::precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER static vecType<D, T, P> call(vecType<D, T, P> const & v, T, T)
|
||||
template<glm::length_t L, typename T, glm::precision P, template<glm::length_t, typename, glm::precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER static vecType<L, T, P> call(vecType<L, T, P> const & v, T, T)
|
||||
{
|
||||
return v;
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
template<>
|
||||
struct compute_bitfieldReverseStep<true>
|
||||
{
|
||||
template <int D, typename T, glm::precision P, template <int, typename, glm::precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER static vecType<D, T, P> call(vecType<D, T, P> const & v, T Mask, T Shift)
|
||||
template<glm::length_t L, typename T, glm::precision P, template<glm::length_t, typename, glm::precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER static vecType<L, T, P> call(vecType<L, T, P> const & v, T Mask, T Shift)
|
||||
{
|
||||
return (v & Mask) << Shift | (v & (~Mask)) >> Shift;
|
||||
}
|
||||
};
|
||||
|
||||
template <int D, typename T, glm::precision P, template <int, typename, glm::precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, T, P> bitfieldReverseOps(vecType<D, T, P> const & v)
|
||||
template<glm::length_t L, typename T, glm::precision P, template<glm::length_t, typename, glm::precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> bitfieldReverseOps(vecType<L, T, P> const & v)
|
||||
{
|
||||
vecType<D, T, P> x(v);
|
||||
vecType<L, T, P> x(v);
|
||||
x = compute_bitfieldReverseStep<sizeof(T) * 8 >= 2>::call(x, T(0x5555555555555555ull), static_cast<T>( 1));
|
||||
x = compute_bitfieldReverseStep<sizeof(T) * 8 >= 4>::call(x, T(0x3333333333333333ull), static_cast<T>( 2));
|
||||
x = compute_bitfieldReverseStep<sizeof(T) * 8 >= 8>::call(x, T(0x0F0F0F0F0F0F0F0Full), static_cast<T>( 4));
|
||||
@@ -227,13 +227,13 @@ namespace bitfieldReverse
|
||||
return x;
|
||||
}
|
||||
|
||||
template <typename genType>
|
||||
template<typename genType>
|
||||
GLM_FUNC_QUALIFIER genType bitfieldReverseOps(genType x)
|
||||
{
|
||||
return bitfieldReverseOps(glm::vec<1, genType, glm::defaultp>(x)).x;
|
||||
}
|
||||
|
||||
template <typename genType>
|
||||
template<typename genType>
|
||||
struct type
|
||||
{
|
||||
genType Value;
|
||||
@@ -538,7 +538,7 @@ namespace bitfieldReverse
|
||||
|
||||
namespace findMSB
|
||||
{
|
||||
template <typename genType, typename retType>
|
||||
template<typename genType, typename retType>
|
||||
struct type
|
||||
{
|
||||
genType Value;
|
||||
@@ -546,7 +546,7 @@ namespace findMSB
|
||||
};
|
||||
|
||||
# if GLM_HAS_BITSCAN_WINDOWS
|
||||
template <typename genIUType>
|
||||
template<typename genIUType>
|
||||
GLM_FUNC_QUALIFIER int findMSB_intrinsic(genIUType Value)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genIUType>::is_integer, "'findMSB' only accept integer values");
|
||||
@@ -561,7 +561,7 @@ namespace findMSB
|
||||
# endif//GLM_HAS_BITSCAN_WINDOWS
|
||||
|
||||
# if GLM_ARCH & GLM_ARCH_AVX && GLM_COMPILER & GLM_COMPILER_VC
|
||||
template <typename genIUType>
|
||||
template<typename genIUType>
|
||||
GLM_FUNC_QUALIFIER int findMSB_avx(genIUType Value)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genIUType>::is_integer, "'findMSB' only accept integer values");
|
||||
@@ -573,7 +573,7 @@ namespace findMSB
|
||||
}
|
||||
# endif//GLM_ARCH & GLM_ARCH_AVX && GLM_PLATFORM & GLM_PLATFORM_WINDOWS
|
||||
|
||||
template <typename genIUType>
|
||||
template<typename genIUType>
|
||||
GLM_FUNC_QUALIFIER int findMSB_095(genIUType Value)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genIUType>::is_integer, "'findMSB' only accept integer values");
|
||||
@@ -597,7 +597,7 @@ namespace findMSB
|
||||
}
|
||||
}
|
||||
|
||||
template <typename genIUType>
|
||||
template<typename genIUType>
|
||||
GLM_FUNC_QUALIFIER int findMSB_nlz1(genIUType x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genIUType>::is_integer, "'findMSB' only accept integer values");
|
||||
@@ -927,7 +927,7 @@ namespace findMSB
|
||||
|
||||
namespace findLSB
|
||||
{
|
||||
template <typename genType, typename retType>
|
||||
template<typename genType, typename retType>
|
||||
struct type
|
||||
{
|
||||
genType Value;
|
||||
@@ -950,7 +950,7 @@ namespace findLSB
|
||||
};
|
||||
|
||||
# if GLM_HAS_BITSCAN_WINDOWS
|
||||
template <typename genIUType>
|
||||
template<typename genIUType>
|
||||
GLM_FUNC_QUALIFIER int findLSB_intrinsic(genIUType Value)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genIUType>::is_integer, "'findLSB' only accept integer values");
|
||||
@@ -964,7 +964,7 @@ namespace findLSB
|
||||
}
|
||||
# endif
|
||||
|
||||
template <typename genIUType>
|
||||
template<typename genIUType>
|
||||
GLM_FUNC_QUALIFIER int findLSB_095(genIUType Value)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genIUType>::is_integer, "'findLSB' only accept integer values");
|
||||
@@ -976,7 +976,7 @@ namespace findLSB
|
||||
return Bit;
|
||||
}
|
||||
|
||||
template <typename genIUType>
|
||||
template<typename genIUType>
|
||||
GLM_FUNC_QUALIFIER int findLSB_ntz2(genIUType x)
|
||||
{
|
||||
if(x == 0)
|
||||
@@ -985,7 +985,7 @@ namespace findLSB
|
||||
return glm::bitCount(~x & (x - static_cast<genIUType>(1)));
|
||||
}
|
||||
|
||||
template <typename genIUType>
|
||||
template<typename genIUType>
|
||||
GLM_FUNC_QUALIFIER int findLSB_branchfree(genIUType x)
|
||||
{
|
||||
bool IsNull(x == 0);
|
||||
@@ -1361,7 +1361,7 @@ namespace imulExtended
|
||||
|
||||
namespace bitCount
|
||||
{
|
||||
template <typename genType>
|
||||
template<typename genType>
|
||||
struct type
|
||||
{
|
||||
genType Value;
|
||||
@@ -1377,7 +1377,7 @@ namespace bitCount
|
||||
{0x00000000, 0}
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
template<typename T>
|
||||
inline int bitCount_if(T v)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_integer, "'bitCount' only accept integer values");
|
||||
@@ -1391,7 +1391,7 @@ namespace bitCount
|
||||
return Count;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
template<typename T>
|
||||
inline int bitCount_vec(T v)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_integer, "'bitCount' only accept integer values");
|
||||
@@ -1404,40 +1404,40 @@ namespace bitCount
|
||||
return Count;
|
||||
}
|
||||
|
||||
template <bool EXEC = false>
|
||||
template<bool EXEC = false>
|
||||
struct compute_bitfieldBitCountStep
|
||||
{
|
||||
template <int D, typename T, glm::precision P, template <int, typename, glm::precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER static vecType<D, T, P> call(vecType<D, T, P> const & v, T, T)
|
||||
template<glm::length_t L, typename T, glm::precision P, template<glm::length_t, typename, glm::precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER static vecType<L, T, P> call(vecType<L, T, P> const & v, T, T)
|
||||
{
|
||||
return v;
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
template<>
|
||||
struct compute_bitfieldBitCountStep<true>
|
||||
{
|
||||
template <int D, typename T, glm::precision P, template <int, typename, glm::precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER static vecType<D, T, P> call(vecType<D, T, P> const & v, T Mask, T Shift)
|
||||
template<glm::length_t L, typename T, glm::precision P, template<glm::length_t, typename, glm::precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER static vecType<L, T, P> call(vecType<L, T, P> const & v, T Mask, T Shift)
|
||||
{
|
||||
return (v & Mask) + ((v >> Shift) & Mask);
|
||||
}
|
||||
};
|
||||
|
||||
template <int D, typename T, glm::precision P, template <int, typename, glm::precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, int, P> bitCount_bitfield(vecType<D, T, P> const & v)
|
||||
template<glm::length_t L, typename T, glm::precision P, template<glm::length_t, typename, glm::precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, int, P> bitCount_bitfield(vecType<L, T, P> const & v)
|
||||
{
|
||||
vecType<D, typename glm::detail::make_unsigned<T>::type, P> x(*reinterpret_cast<vecType<D, typename glm::detail::make_unsigned<T>::type, P> const *>(&v));
|
||||
vecType<L, typename glm::detail::make_unsigned<T>::type, P> x(*reinterpret_cast<vecType<L, typename glm::detail::make_unsigned<T>::type, P> const *>(&v));
|
||||
x = compute_bitfieldBitCountStep<sizeof(T) * 8 >= 2>::call(x, typename glm::detail::make_unsigned<T>::type(0x5555555555555555ull), typename glm::detail::make_unsigned<T>::type( 1));
|
||||
x = compute_bitfieldBitCountStep<sizeof(T) * 8 >= 4>::call(x, typename glm::detail::make_unsigned<T>::type(0x3333333333333333ull), typename glm::detail::make_unsigned<T>::type( 2));
|
||||
x = compute_bitfieldBitCountStep<sizeof(T) * 8 >= 8>::call(x, typename glm::detail::make_unsigned<T>::type(0x0F0F0F0F0F0F0F0Full), typename glm::detail::make_unsigned<T>::type( 4));
|
||||
x = compute_bitfieldBitCountStep<sizeof(T) * 8 >= 16>::call(x, typename glm::detail::make_unsigned<T>::type(0x00FF00FF00FF00FFull), typename glm::detail::make_unsigned<T>::type( 8));
|
||||
x = compute_bitfieldBitCountStep<sizeof(T) * 8 >= 32>::call(x, typename glm::detail::make_unsigned<T>::type(0x0000FFFF0000FFFFull), typename glm::detail::make_unsigned<T>::type(16));
|
||||
x = compute_bitfieldBitCountStep<sizeof(T) * 8 >= 64>::call(x, typename glm::detail::make_unsigned<T>::type(0x00000000FFFFFFFFull), typename glm::detail::make_unsigned<T>::type(32));
|
||||
return vecType<D, int, P>(x);
|
||||
return vecType<L, int, P>(x);
|
||||
}
|
||||
|
||||
template <typename genType>
|
||||
template<typename genType>
|
||||
GLM_FUNC_QUALIFIER int bitCount_bitfield(genType x)
|
||||
{
|
||||
return bitCount_bitfield(glm::vec<1, genType, glm::defaultp>(x)).x;
|
||||
|
||||
@@ -208,7 +208,7 @@ int test_inverse_simd()
|
||||
return Error;
|
||||
}
|
||||
|
||||
template <typename VEC3, typename MAT4>
|
||||
template<typename VEC3, typename MAT4>
|
||||
int test_inverse_perf(std::size_t Count, std::size_t Instance, char const * Message)
|
||||
{
|
||||
std::vector<MAT4> TestInputs;
|
||||
|
||||
@@ -196,19 +196,19 @@ int test_operators()
|
||||
return (S && !R) ? 0 : 1;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
template<typename T>
|
||||
struct vec
|
||||
{
|
||||
|
||||
};
|
||||
|
||||
template <template <typename> class C, typename T>
|
||||
template<template<typename> class C, typename T>
|
||||
struct Class
|
||||
{
|
||||
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
template<typename T>
|
||||
struct Class<vec, T>
|
||||
{
|
||||
|
||||
|
||||
@@ -99,7 +99,7 @@ int test_ctr()
|
||||
|
||||
namespace cast
|
||||
{
|
||||
template <typename genType>
|
||||
template<typename genType>
|
||||
int entry()
|
||||
{
|
||||
int Error = 0;
|
||||
|
||||
@@ -73,7 +73,7 @@ int test_ctr()
|
||||
|
||||
namespace cast
|
||||
{
|
||||
template <typename genType>
|
||||
template<typename genType>
|
||||
int entry()
|
||||
{
|
||||
int Error = 0;
|
||||
|
||||
@@ -73,7 +73,7 @@ int test_ctr()
|
||||
|
||||
namespace cast
|
||||
{
|
||||
template <typename genType>
|
||||
template<typename genType>
|
||||
int entry()
|
||||
{
|
||||
int Error = 0;
|
||||
|
||||
@@ -77,7 +77,7 @@ int test_ctr()
|
||||
|
||||
namespace cast
|
||||
{
|
||||
template <typename genType>
|
||||
template<typename genType>
|
||||
int entry()
|
||||
{
|
||||
int Error = 0;
|
||||
|
||||
@@ -136,7 +136,7 @@ int test_ctr()
|
||||
|
||||
namespace cast
|
||||
{
|
||||
template <typename genType>
|
||||
template<typename genType>
|
||||
int entry()
|
||||
{
|
||||
int Error = 0;
|
||||
|
||||
@@ -77,7 +77,7 @@ int test_ctr()
|
||||
|
||||
namespace cast
|
||||
{
|
||||
template <typename genType>
|
||||
template<typename genType>
|
||||
int entry()
|
||||
{
|
||||
int Error = 0;
|
||||
|
||||
@@ -81,7 +81,7 @@ int test_ctr()
|
||||
|
||||
namespace cast
|
||||
{
|
||||
template <typename genType>
|
||||
template<typename genType>
|
||||
int entry()
|
||||
{
|
||||
int Error = 0;
|
||||
|
||||
@@ -81,7 +81,7 @@ int test_ctr()
|
||||
|
||||
namespace cast
|
||||
{
|
||||
template <typename genType>
|
||||
template<typename genType>
|
||||
int entry()
|
||||
{
|
||||
int Error = 0;
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
#include <vector>
|
||||
|
||||
|
||||
template <typename genType>
|
||||
template<typename genType>
|
||||
void print(genType const & Mat0)
|
||||
{
|
||||
printf("mat4(\n");
|
||||
@@ -253,7 +253,7 @@ int perf_mul()
|
||||
|
||||
namespace cast
|
||||
{
|
||||
template <typename genType>
|
||||
template<typename genType>
|
||||
int entry()
|
||||
{
|
||||
int Error = 0;
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#include <ctime>
|
||||
#include <vector>
|
||||
|
||||
template <int Value>
|
||||
template<int Value>
|
||||
struct mask
|
||||
{
|
||||
enum{value = Value};
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
namespace mask
|
||||
{
|
||||
template <typename genType>
|
||||
template<typename genType>
|
||||
struct type
|
||||
{
|
||||
genType Value;
|
||||
@@ -195,7 +195,7 @@ namespace mask
|
||||
|
||||
namespace bitfieldInterleave3
|
||||
{
|
||||
template <typename PARAM, typename RET>
|
||||
template<typename PARAM, typename RET>
|
||||
inline RET refBitfieldInterleave(PARAM x, PARAM y, PARAM z)
|
||||
{
|
||||
RET Result = 0;
|
||||
@@ -231,7 +231,7 @@ namespace bitfieldInterleave3
|
||||
|
||||
namespace bitfieldInterleave4
|
||||
{
|
||||
template <typename PARAM, typename RET>
|
||||
template<typename PARAM, typename RET>
|
||||
inline RET loopBitfieldInterleave(PARAM x, PARAM y, PARAM z, PARAM w)
|
||||
{
|
||||
RET const v[4] = {x, y, z, w};
|
||||
|
||||
@@ -25,7 +25,7 @@ int test_defined()
|
||||
return 0;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
template<typename T>
|
||||
int test_equal()
|
||||
{
|
||||
int Error(0);
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
namespace isPowerOfTwo
|
||||
{
|
||||
template <typename genType>
|
||||
template<typename genType>
|
||||
struct type
|
||||
{
|
||||
genType Value;
|
||||
@@ -146,7 +146,7 @@ namespace isPowerOfTwo
|
||||
|
||||
namespace ceilPowerOfTwo_advanced
|
||||
{
|
||||
template <typename genIUType>
|
||||
template<typename genIUType>
|
||||
GLM_FUNC_QUALIFIER genIUType highestBitValue(genIUType Value)
|
||||
{
|
||||
genIUType tmp = Value;
|
||||
@@ -159,13 +159,13 @@ namespace ceilPowerOfTwo_advanced
|
||||
return result;
|
||||
}
|
||||
|
||||
template <typename genType>
|
||||
template<typename genType>
|
||||
GLM_FUNC_QUALIFIER genType ceilPowerOfTwo_loop(genType value)
|
||||
{
|
||||
return glm::isPowerOfTwo(value) ? value : highestBitValue(value) << 1;
|
||||
}
|
||||
|
||||
template <typename genType>
|
||||
template<typename genType>
|
||||
struct type
|
||||
{
|
||||
genType Value;
|
||||
@@ -332,7 +332,7 @@ namespace ceilPowerOfTwo
|
||||
|
||||
namespace floorMultiple
|
||||
{
|
||||
template <typename genType>
|
||||
template<typename genType>
|
||||
struct type
|
||||
{
|
||||
genType Source;
|
||||
@@ -372,7 +372,7 @@ namespace floorMultiple
|
||||
|
||||
namespace ceilMultiple
|
||||
{
|
||||
template <typename genType>
|
||||
template<typename genType>
|
||||
struct type
|
||||
{
|
||||
genType Source;
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
namespace fmod_
|
||||
{
|
||||
template <typename genType>
|
||||
template<typename genType>
|
||||
GLM_FUNC_QUALIFIER genType modTrunc(genType a, genType b)
|
||||
{
|
||||
return a - b * glm::trunc(a / b);
|
||||
|
||||
@@ -177,13 +177,13 @@ namespace taylorCos
|
||||
|
||||
glm::vec4 const AngleShift(0.0f, glm::pi<float>() * 0.5f, glm::pi<float>() * 1.0f, glm::pi<float>() * 1.5f);
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, T, P> taylorSeriesNewCos(vecType<D, T, P> const & x)
|
||||
template<glm::length_t L, typename T, precision P, template<glm::length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> taylorSeriesNewCos(vecType<L, T, P> const & x)
|
||||
{
|
||||
vecType<D, T, P> const Powed2(x * x);
|
||||
vecType<D, T, P> const Powed4(Powed2 * Powed2);
|
||||
vecType<D, T, P> const Powed6(Powed4 * Powed2);
|
||||
vecType<D, T, P> const Powed8(Powed4 * Powed4);
|
||||
vecType<L, T, P> const Powed2(x * x);
|
||||
vecType<L, T, P> const Powed4(Powed2 * Powed2);
|
||||
vecType<L, T, P> const Powed6(Powed4 * Powed2);
|
||||
vecType<L, T, P> const Powed8(Powed4 * Powed4);
|
||||
|
||||
return static_cast<T>(1)
|
||||
- Powed2 * static_cast<T>(0.5)
|
||||
@@ -192,12 +192,12 @@ namespace taylorCos
|
||||
+ Powed8 * static_cast<T>(2.4801587301587301587301587301587e-5);
|
||||
}
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, T, P> taylorSeriesNewCos6(vecType<D, T, P> const & x)
|
||||
template<glm::length_t L, typename T, precision P, template<glm::length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> taylorSeriesNewCos6(vecType<L, T, P> const & x)
|
||||
{
|
||||
vecType<D, T, P> const Powed2(x * x);
|
||||
vecType<D, T, P> const Powed4(Powed2 * Powed2);
|
||||
vecType<D, T, P> const Powed6(Powed4 * Powed2);
|
||||
vecType<L, T, P> const Powed2(x * x);
|
||||
vecType<L, T, P> const Powed4(Powed2 * Powed2);
|
||||
vecType<L, T, P> const Powed6(Powed4 * Powed2);
|
||||
|
||||
return static_cast<T>(1)
|
||||
- Powed2 * static_cast<T>(0.5)
|
||||
@@ -205,8 +205,8 @@ namespace taylorCos
|
||||
- Powed6 * static_cast<T>(0.00138888888888888888888888888889);
|
||||
}
|
||||
|
||||
template <int D, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, float, P> fastAbs(vecType<D, float, P> x)
|
||||
template<glm::length_t L, precision P, template<glm::length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, float, P> fastAbs(vecType<L, float, P> x)
|
||||
{
|
||||
int* Pointer = reinterpret_cast<int*>(&x[0]);
|
||||
Pointer[0] &= 0x7fffffff;
|
||||
@@ -216,17 +216,17 @@ namespace taylorCos
|
||||
return x;
|
||||
}
|
||||
|
||||
template <int D, typename T, glm::precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, T, P> fastCosNew(vecType<D, T, P> const & x)
|
||||
template<glm::length_t L, typename T, glm::precision P, template<glm::length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> fastCosNew(vecType<L, T, P> const & x)
|
||||
{
|
||||
vecType<D, T, P> const Angle0_PI(fastAbs(fmod(x + glm::pi<T>(), glm::two_pi<T>()) - glm::pi<T>()));
|
||||
vecType<L, T, P> const Angle0_PI(fastAbs(fmod(x + glm::pi<T>(), glm::two_pi<T>()) - glm::pi<T>()));
|
||||
return taylorSeriesNewCos6(x);
|
||||
/*
|
||||
vecType<D, bool, P> const FirstQuarterPi(lessThanEqual(Angle0_PI, vecType<D, T, P>(glm::half_pi<T>())));
|
||||
vecType<L, bool, P> const FirstQuarterPi(lessThanEqual(Angle0_PI, vecType<L, T, P>(glm::half_pi<T>())));
|
||||
|
||||
vecType<D, T, P> const RevertAngle(mix(vecType<D, T, P>(glm::pi<T>()), vecType<D, T, P>(0), FirstQuarterPi));
|
||||
vecType<D, T, P> const ReturnSign(mix(vecType<D, T, P>(-1), vecType<D, T, P>(1), FirstQuarterPi));
|
||||
vecType<D, T, P> const SectionAngle(RevertAngle - Angle0_PI);
|
||||
vecType<L, T, P> const RevertAngle(mix(vecType<L, T, P>(glm::pi<T>()), vecType<L, T, P>(0), FirstQuarterPi));
|
||||
vecType<L, T, P> const ReturnSign(mix(vecType<L, T, P>(-1), vecType<L, T, P>(1), FirstQuarterPi));
|
||||
vecType<L, T, P> const SectionAngle(RevertAngle - Angle0_PI);
|
||||
|
||||
return ReturnSign * taylorSeriesNewCos(SectionAngle);
|
||||
*/
|
||||
@@ -254,21 +254,21 @@ namespace taylorCos
|
||||
return Error;
|
||||
}
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, T, P> deterministic_fmod(vecType<D, T, P> const & x, T y)
|
||||
template<glm::length_t L, typename T, precision P, template<glm::length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> deterministic_fmod(vecType<L, T, P> const & x, T y)
|
||||
{
|
||||
return x - y * trunc(x / y);
|
||||
}
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, T, P> fastCosDeterminisctic(vecType<D, T, P> const & x)
|
||||
template<glm::length_t L, typename T, precision P, template<glm::length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> fastCosDeterminisctic(vecType<L, T, P> const & x)
|
||||
{
|
||||
vecType<D, T, P> const Angle0_PI(abs(deterministic_fmod(x + glm::pi<T>(), glm::two_pi<T>()) - glm::pi<T>()));
|
||||
vecType<D, bool, P> const FirstQuarterPi(lessThanEqual(Angle0_PI, vecType<D, T, P>(glm::half_pi<T>())));
|
||||
vecType<L, T, P> const Angle0_PI(abs(deterministic_fmod(x + glm::pi<T>(), glm::two_pi<T>()) - glm::pi<T>()));
|
||||
vecType<L, bool, P> const FirstQuarterPi(lessThanEqual(Angle0_PI, vecType<L, T, P>(glm::half_pi<T>())));
|
||||
|
||||
vecType<D, T, P> const RevertAngle(mix(vecType<D, T, P>(glm::pi<T>()), vecType<D, T, P>(0), FirstQuarterPi));
|
||||
vecType<D, T, P> const ReturnSign(mix(vecType<D, T, P>(-1), vecType<D, T, P>(1), FirstQuarterPi));
|
||||
vecType<D, T, P> const SectionAngle(RevertAngle - Angle0_PI);
|
||||
vecType<L, T, P> const RevertAngle(mix(vecType<L, T, P>(glm::pi<T>()), vecType<L, T, P>(0), FirstQuarterPi));
|
||||
vecType<L, T, P> const ReturnSign(mix(vecType<L, T, P>(-1), vecType<L, T, P>(1), FirstQuarterPi));
|
||||
vecType<L, T, P> const SectionAngle(RevertAngle - Angle0_PI);
|
||||
|
||||
return ReturnSign * taylorSeriesNewCos(SectionAngle);
|
||||
}
|
||||
@@ -295,8 +295,8 @@ namespace taylorCos
|
||||
return Error;
|
||||
}
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, T, P> taylorSeriesRefCos(vecType<D, T, P> const & x)
|
||||
template<glm::length_t L, typename T, precision P, template<glm::length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> taylorSeriesRefCos(vecType<L, T, P> const & x)
|
||||
{
|
||||
return static_cast<T>(1)
|
||||
- (x * x) / glm::factorial(static_cast<T>(2))
|
||||
@@ -305,17 +305,17 @@ namespace taylorCos
|
||||
+ (x * x * x * x * x * x * x * x) / glm::factorial(static_cast<T>(8));
|
||||
}
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, T, P> fastRefCos(vecType<D, T, P> const & x)
|
||||
template<glm::length_t L, typename T, precision P, template<glm::length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> fastRefCos(vecType<L, T, P> const & x)
|
||||
{
|
||||
vecType<D, T, P> const Angle0_PI(glm::abs(fmod(x + glm::pi<T>(), glm::two_pi<T>()) - glm::pi<T>()));
|
||||
vecType<L, T, P> const Angle0_PI(glm::abs(fmod(x + glm::pi<T>(), glm::two_pi<T>()) - glm::pi<T>()));
|
||||
// return taylorSeriesRefCos(Angle0_PI);
|
||||
|
||||
vecType<D, bool, P> const FirstQuarterPi(lessThanEqual(Angle0_PI, vecType<D, T, P>(glm::half_pi<T>())));
|
||||
vecType<L, bool, P> const FirstQuarterPi(lessThanEqual(Angle0_PI, vecType<L, T, P>(glm::half_pi<T>())));
|
||||
|
||||
vecType<D, T, P> const RevertAngle(mix(vecType<D, T, P>(glm::pi<T>()), vecType<D, T, P>(0), FirstQuarterPi));
|
||||
vecType<D, T, P> const ReturnSign(mix(vecType<D, T, P>(-1), vecType<D, T, P>(1), FirstQuarterPi));
|
||||
vecType<D, T, P> const SectionAngle(RevertAngle - Angle0_PI);
|
||||
vecType<L, T, P> const RevertAngle(mix(vecType<L, T, P>(glm::pi<T>()), vecType<L, T, P>(0), FirstQuarterPi));
|
||||
vecType<L, T, P> const ReturnSign(mix(vecType<L, T, P>(-1), vecType<L, T, P>(1), FirstQuarterPi));
|
||||
vecType<L, T, P> const SectionAngle(RevertAngle - Angle0_PI);
|
||||
|
||||
return ReturnSign * taylorSeriesRefCos(SectionAngle);
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
namespace
|
||||
{
|
||||
template <typename CTy, typename CTr>
|
||||
template<typename CTy, typename CTr>
|
||||
std::basic_ostream<CTy,CTr>& operator<<(std::basic_ostream<CTy,CTr>& os, glm::precision const& a)
|
||||
{
|
||||
typename std::basic_ostream<CTy,CTr>::sentry const cerberus(os);
|
||||
@@ -29,7 +29,7 @@ namespace
|
||||
return os;
|
||||
}
|
||||
|
||||
template <typename U, glm::precision P, typename T, typename CTy, typename CTr>
|
||||
template<typename U, glm::precision P, typename T, typename CTy, typename CTr>
|
||||
std::basic_string<CTy> type_name(std::basic_ostream<CTy,CTr>& os, T const&)
|
||||
{
|
||||
std::basic_ostringstream<CTy,CTr> ostr;
|
||||
@@ -55,7 +55,7 @@ namespace
|
||||
}
|
||||
} // namespace {
|
||||
|
||||
template <typename T, glm::precision P, typename OS>
|
||||
template<typename T, glm::precision P, typename OS>
|
||||
int test_io_quat(OS& os)
|
||||
{
|
||||
os << '\n' << typeid(OS).name() << '\n';
|
||||
@@ -79,7 +79,7 @@ int test_io_quat(OS& os)
|
||||
return 0;
|
||||
}
|
||||
|
||||
template <typename T, glm::precision P, typename OS>
|
||||
template<typename T, glm::precision P, typename OS>
|
||||
int test_io_vec(OS& os)
|
||||
{
|
||||
os << '\n' << typeid(OS).name() << '\n';
|
||||
@@ -102,7 +102,7 @@ int test_io_vec(OS& os)
|
||||
return 0;
|
||||
}
|
||||
|
||||
template <typename T, glm::precision P, typename OS>
|
||||
template<typename T, glm::precision P, typename OS>
|
||||
int test_io_mat(OS& os, glm::io::order_type otype)
|
||||
{
|
||||
os << '\n' << typeid(OS).name() << '\n';
|
||||
|
||||
@@ -79,7 +79,7 @@ int test_decl()
|
||||
return Error;
|
||||
}
|
||||
|
||||
template <typename genType>
|
||||
template<typename genType>
|
||||
void print(genType const & Mat0)
|
||||
{
|
||||
printf("mat4(\n");
|
||||
|
||||
Reference in New Issue
Block a user