diff --git a/glm/detail/func_integer.inl b/glm/detail/func_integer.inl index 6cd6eeb7..0891eb01 100644 --- a/glm/detail/func_integer.inl +++ b/glm/detail/func_integer.inl @@ -21,7 +21,7 @@ namespace detail return Bits >= sizeof(T) * 8 ? ~static_cast(0) : (static_cast(1) << Bits) - static_cast(1); } - template class vecType, bool EXEC = false> + template class vecType, bool Aligned, bool EXEC> struct compute_bitfieldReverseStep { GLM_FUNC_QUALIFIER static vecType call(vecType const & v, T, T) @@ -30,8 +30,8 @@ namespace detail } }; - template class vecType> - struct compute_bitfieldReverseStep + template class vecType, bool Aligned> + struct compute_bitfieldReverseStep { GLM_FUNC_QUALIFIER static vecType call(vecType const & v, T Mask, T Shift) { @@ -39,7 +39,7 @@ namespace detail } }; - template class vecType, bool EXEC = false> + template class vecType, bool Aligned, bool EXEC> struct compute_bitfieldBitCountStep { GLM_FUNC_QUALIFIER static vecType call(vecType const & v, T, T) @@ -48,8 +48,8 @@ namespace detail } }; - template class vecType> - struct compute_bitfieldBitCountStep + template class vecType, bool Aligned> + struct compute_bitfieldBitCountStep { GLM_FUNC_QUALIFIER static vecType call(vecType const & v, T Mask, T Shift) { @@ -289,12 +289,12 @@ namespace detail GLM_FUNC_QUALIFIER vecType bitfieldReverse(vecType const & v) { vecType x(v); - x = detail::compute_bitfieldReverseStep= 2>::call(x, T(0x5555555555555555ull), static_cast( 1)); - x = detail::compute_bitfieldReverseStep= 4>::call(x, T(0x3333333333333333ull), static_cast( 2)); - x = detail::compute_bitfieldReverseStep= 8>::call(x, T(0x0F0F0F0F0F0F0F0Full), static_cast( 4)); - x = detail::compute_bitfieldReverseStep= 16>::call(x, T(0x00FF00FF00FF00FFull), static_cast( 8)); - x = detail::compute_bitfieldReverseStep= 32>::call(x, T(0x0000FFFF0000FFFFull), static_cast(16)); - x = detail::compute_bitfieldReverseStep= 64>::call(x, T(0x00000000FFFFFFFFull), static_cast(32)); + x = detail::compute_bitfieldReverseStep::value, sizeof(T) * 8>= 2>::call(x, T(0x5555555555555555ull), static_cast( 1)); + x = detail::compute_bitfieldReverseStep::value, sizeof(T) * 8>= 4>::call(x, T(0x3333333333333333ull), static_cast( 2)); + x = detail::compute_bitfieldReverseStep::value, sizeof(T) * 8>= 8>::call(x, T(0x0F0F0F0F0F0F0F0Full), static_cast( 4)); + x = detail::compute_bitfieldReverseStep::value, sizeof(T) * 8>= 16>::call(x, T(0x00FF00FF00FF00FFull), static_cast( 8)); + x = detail::compute_bitfieldReverseStep::value, sizeof(T) * 8>= 32>::call(x, T(0x0000FFFF0000FFFFull), static_cast(16)); + x = detail::compute_bitfieldReverseStep::value, sizeof(T) * 8>= 64>::call(x, T(0x00000000FFFFFFFFull), static_cast(32)); return x; } @@ -309,12 +309,12 @@ namespace detail GLM_FUNC_QUALIFIER vecType bitCount(vecType const & v) { vecType::type, P> x(*reinterpret_cast::type, P> const *>(&v)); - x = detail::compute_bitfieldBitCountStep= 2>::call(x, typename detail::make_unsigned::type(0x5555555555555555ull), typename detail::make_unsigned::type( 1)); - x = detail::compute_bitfieldBitCountStep= 4>::call(x, typename detail::make_unsigned::type(0x3333333333333333ull), typename detail::make_unsigned::type( 2)); - x = detail::compute_bitfieldBitCountStep= 8>::call(x, typename detail::make_unsigned::type(0x0F0F0F0F0F0F0F0Full), typename detail::make_unsigned::type( 4)); - x = detail::compute_bitfieldBitCountStep= 16>::call(x, typename detail::make_unsigned::type(0x00FF00FF00FF00FFull), typename detail::make_unsigned::type( 8)); - x = detail::compute_bitfieldBitCountStep= 32>::call(x, typename detail::make_unsigned::type(0x0000FFFF0000FFFFull), typename detail::make_unsigned::type(16)); - x = detail::compute_bitfieldBitCountStep= 64>::call(x, typename detail::make_unsigned::type(0x00000000FFFFFFFFull), typename detail::make_unsigned::type(32)); + x = detail::compute_bitfieldBitCountStep::type, P, vecType, detail::is_aligned

::value, sizeof(T) * 8>= 2>::call(x, typename detail::make_unsigned::type(0x5555555555555555ull), typename detail::make_unsigned::type( 1)); + x = detail::compute_bitfieldBitCountStep::type, P, vecType, detail::is_aligned

::value, sizeof(T) * 8>= 4>::call(x, typename detail::make_unsigned::type(0x3333333333333333ull), typename detail::make_unsigned::type( 2)); + x = detail::compute_bitfieldBitCountStep::type, P, vecType, detail::is_aligned

::value, sizeof(T) * 8>= 8>::call(x, typename detail::make_unsigned::type(0x0F0F0F0F0F0F0F0Full), typename detail::make_unsigned::type( 4)); + x = detail::compute_bitfieldBitCountStep::type, P, vecType, detail::is_aligned

::value, sizeof(T) * 8>= 16>::call(x, typename detail::make_unsigned::type(0x00FF00FF00FF00FFull), typename detail::make_unsigned::type( 8)); + x = detail::compute_bitfieldBitCountStep::type, P, vecType, detail::is_aligned

::value, sizeof(T) * 8>= 32>::call(x, typename detail::make_unsigned::type(0x0000FFFF0000FFFFull), typename detail::make_unsigned::type(16)); + x = detail::compute_bitfieldBitCountStep::type, P, vecType, detail::is_aligned

::value, sizeof(T) * 8>= 64>::call(x, typename detail::make_unsigned::type(0x00000000FFFFFFFFull), typename detail::make_unsigned::type(32)); return vecType(x); } diff --git a/glm/detail/func_integer_simd.inl b/glm/detail/func_integer_simd.inl index 99e0ebbc..c79e8618 100644 --- a/glm/detail/func_integer_simd.inl +++ b/glm/detail/func_integer_simd.inl @@ -9,7 +9,7 @@ namespace glm{ namespace detail { template - struct compute_bitfieldReverseStep + struct compute_bitfieldReverseStep { GLM_FUNC_QUALIFIER static tvec4 call(tvec4 const & v, uint32 Mask, uint32 Shift) { @@ -30,7 +30,7 @@ namespace detail }; template - struct compute_bitfieldBitCountStep + struct compute_bitfieldBitCountStep { GLM_FUNC_QUALIFIER static tvec4 call(tvec4 const & v, uint32 Mask, uint32 Shift) { diff --git a/glm/detail/type_vec.hpp b/glm/detail/type_vec.hpp index 11b25347..99aa4d48 100644 --- a/glm/detail/type_vec.hpp +++ b/glm/detail/type_vec.hpp @@ -16,7 +16,7 @@ namespace detail uint8 data[size]; } type; }; - +/* template struct storage { @@ -24,7 +24,7 @@ namespace detail uint8 data[size]; } type; }; - +*/ # if GLM_ARCH & GLM_ARCH_SSE2_BIT template <> struct storage diff --git a/test/gtc/gtc_type_aligned.cpp b/test/gtc/gtc_type_aligned.cpp index fc0a66de..d321ef83 100644 --- a/test/gtc/gtc_type_aligned.cpp +++ b/test/gtc/gtc_type_aligned.cpp @@ -57,7 +57,7 @@ int test_copy() int Error = 0; { - glm::aligned_ivec4 const a(1); + glm::aligned_ivec4 const a(1, 2, 3, 4); glm::ivec4 const u(a); Error += a.x == u.x ? 0 : 1; @@ -68,10 +68,10 @@ int test_copy() { my_ivec4_aligned a; - a.b = glm::ivec4(1); + a.b = glm::ivec4(1, 2, 3, 4); my_ivec4_packed u; - u.b = glm::ivec4(1); + u.b = a.b; Error += a.b.x == u.b.x ? 0 : 1; Error += a.b.y == u.b.y ? 0 : 1;