From ef7c6e0c8a6781d0598b3f38b89398fdfe77b8bf Mon Sep 17 00:00:00 2001 From: christophe Date: Sun, 19 Oct 2025 15:24:14 +0200 Subject: [PATCH] Remove custom make_unsigned --- glm/detail/func_common.inl | 2 +- glm/detail/func_integer.inl | 14 ++--- glm/detail/setup.hpp | 91 --------------------------------- test/core/core_func_integer.cpp | 14 ++--- 4 files changed, 15 insertions(+), 106 deletions(-) diff --git a/glm/detail/func_common.inl b/glm/detail/func_common.inl index 390541528..2c6851a0f 100644 --- a/glm/detail/func_common.inl +++ b/glm/detail/func_common.inl @@ -163,7 +163,7 @@ namespace detail GLM_FUNC_QUALIFIER static vec call(vec const& x) { T const Shift(static_cast(sizeof(T) * 8 - 1)); - vec const y(vec::type, Q>(-x) >> typename detail::make_unsigned::type(Shift)); + vec const y(vec::type, Q>(-x) >> typename std::make_unsigned::type(Shift)); return (x >> Shift) | y; } diff --git a/glm/detail/func_integer.inl b/glm/detail/func_integer.inl index 739606db9..7f6f08dc1 100644 --- a/glm/detail/func_integer.inl +++ b/glm/detail/func_integer.inl @@ -328,13 +328,13 @@ namespace detail # pragma warning(disable : 4310) //cast truncates constant value # endif - vec::type, Q> x(v); - x = detail::compute_bitfieldBitCountStep::type, Q, 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, Q, 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, Q, 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, Q, 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, Q, 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, Q, detail::is_aligned::value, sizeof(T) * 8>= 64>::call(x, typename detail::make_unsigned::type(0x00000000FFFFFFFFull), typename detail::make_unsigned::type(32)); + vec::type, Q> x(v); + x = detail::compute_bitfieldBitCountStep::type, Q, detail::is_aligned::value, sizeof(T) * 8>= 2>::call(x, typename std::make_unsigned::type(0x5555555555555555ull), typename std::make_unsigned::type( 1)); + x = detail::compute_bitfieldBitCountStep::type, Q, detail::is_aligned::value, sizeof(T) * 8>= 4>::call(x, typename std::make_unsigned::type(0x3333333333333333ull), typename std::make_unsigned::type( 2)); + x = detail::compute_bitfieldBitCountStep::type, Q, detail::is_aligned::value, sizeof(T) * 8>= 8>::call(x, typename std::make_unsigned::type(0x0F0F0F0F0F0F0F0Full), typename std::make_unsigned::type( 4)); + x = detail::compute_bitfieldBitCountStep::type, Q, detail::is_aligned::value, sizeof(T) * 8>= 16>::call(x, typename std::make_unsigned::type(0x00FF00FF00FF00FFull), typename std::make_unsigned::type( 8)); + x = detail::compute_bitfieldBitCountStep::type, Q, detail::is_aligned::value, sizeof(T) * 8>= 32>::call(x, typename std::make_unsigned::type(0x0000FFFF0000FFFFull), typename std::make_unsigned::type(16)); + x = detail::compute_bitfieldBitCountStep::type, Q, detail::is_aligned::value, sizeof(T) * 8>= 64>::call(x, typename std::make_unsigned::type(0x00000000FFFFFFFFull), typename std::make_unsigned::type(32)); return vec(x); # if GLM_COMPILER & GLM_COMPILER_VC diff --git a/glm/detail/setup.hpp b/glm/detail/setup.hpp index 2d897a838..51e28401b 100644 --- a/glm/detail/setup.hpp +++ b/glm/detail/setup.hpp @@ -640,97 +640,6 @@ namespace detail }//namespace detail }//namespace glm -/////////////////////////////////////////////////////////////////////////////////// -// make_unsigned - -#if GLM_HAS_MAKE_SIGNED -# include - -namespace glm{ -namespace detail -{ - using std::make_unsigned; -}//namespace detail -}//namespace glm - -#else - -namespace glm{ -namespace detail -{ - template - struct make_unsigned - {}; - - template<> - struct make_unsigned - { - typedef unsigned char type; - }; - - template<> - struct make_unsigned - { - typedef unsigned char type; - }; - - template<> - struct make_unsigned - { - typedef unsigned short type; - }; - - template<> - struct make_unsigned - { - typedef unsigned int type; - }; - - template<> - struct make_unsigned - { - typedef unsigned long type; - }; - - template<> - struct make_unsigned - { - typedef uint64 type; - }; - - template<> - struct make_unsigned - { - typedef unsigned char type; - }; - - template<> - struct make_unsigned - { - typedef unsigned short type; - }; - - template<> - struct make_unsigned - { - typedef unsigned int type; - }; - - template<> - struct make_unsigned - { - typedef unsigned long type; - }; - - template<> - struct make_unsigned - { - typedef uint64 type; - }; -}//namespace detail -}//namespace glm -#endif - /////////////////////////////////////////////////////////////////////////////////// // Only use x, y, z, w as vector type components diff --git a/test/core/core_func_integer.cpp b/test/core/core_func_integer.cpp index d76018503..041484977 100644 --- a/test/core/core_func_integer.cpp +++ b/test/core/core_func_integer.cpp @@ -1449,13 +1449,13 @@ namespace bitCount template static glm::vec bitCount_bitfield(glm::vec const& v) { - glm::vec::type, Q> x(v); - x = compute_bitfieldBitCountStep= 2>::call(x, static_cast::type>(0x5555555555555555ull), static_cast::type>( 1)); - x = compute_bitfieldBitCountStep= 4>::call(x, static_cast::type>(0x3333333333333333ull), static_cast::type>( 2)); - x = compute_bitfieldBitCountStep= 8>::call(x, static_cast::type>(0x0F0F0F0F0F0F0F0Full), static_cast::type>( 4)); - x = compute_bitfieldBitCountStep= 16>::call(x, static_cast::type>(0x00FF00FF00FF00FFull), static_cast::type>( 8)); - x = compute_bitfieldBitCountStep= 32>::call(x, static_cast::type>(0x0000FFFF0000FFFFull), static_cast::type>(16)); - x = compute_bitfieldBitCountStep= 64>::call(x, static_cast::type>(0x00000000FFFFFFFFull), static_cast::type>(32)); + glm::vec::type, Q> x(v); + x = compute_bitfieldBitCountStep= 2>::call(x, static_cast::type>(0x5555555555555555ull), static_cast::type>( 1)); + x = compute_bitfieldBitCountStep= 4>::call(x, static_cast::type>(0x3333333333333333ull), static_cast::type>( 2)); + x = compute_bitfieldBitCountStep= 8>::call(x, static_cast::type>(0x0F0F0F0F0F0F0F0Full), static_cast::type>( 4)); + x = compute_bitfieldBitCountStep= 16>::call(x, static_cast::type>(0x00FF00FF00FF00FFull), static_cast::type>( 8)); + x = compute_bitfieldBitCountStep= 32>::call(x, static_cast::type>(0x0000FFFF0000FFFFull), static_cast::type>(16)); + x = compute_bitfieldBitCountStep= 64>::call(x, static_cast::type>(0x00000000FFFFFFFFull), static_cast::type>(32)); return glm::vec(x); }