Browse Source

Remove custom make_unsigned

christophe 1 month ago
parent
commit
fae72297c9
4 changed files with 15 additions and 106 deletions
  1. 1 1
      glm/detail/func_common.inl
  2. 7 7
      glm/detail/func_integer.inl
  3. 0 91
      glm/detail/setup.hpp
  4. 7 7
      test/core/core_func_integer.cpp

+ 1 - 1
glm/detail/func_common.inl

@@ -163,7 +163,7 @@ namespace detail
 		GLM_FUNC_QUALIFIER static vec<L, T, Q> call(vec<L, T, Q> const& x)
 		{
 			T const Shift(static_cast<T>(sizeof(T) * 8 - 1));
-			vec<L, T, Q> const y(vec<L, typename detail::make_unsigned<T>::type, Q>(-x) >> typename detail::make_unsigned<T>::type(Shift));
+			vec<L, T, Q> const y(vec<L, typename std::make_unsigned<T>::type, Q>(-x) >> typename std::make_unsigned<T>::type(Shift));
 
 			return (x >> Shift) | y;
 		}

+ 7 - 7
glm/detail/func_integer.inl

@@ -328,13 +328,13 @@ namespace detail
 #			pragma warning(disable : 4310) //cast truncates constant value
 #		endif
 
-		vec<L, typename detail::make_unsigned<T>::type, Q> x(v);
-		x = detail::compute_bitfieldBitCountStep<L, typename detail::make_unsigned<T>::type, Q, detail::is_aligned<Q>::value, sizeof(T) * 8>=  2>::call(x, typename detail::make_unsigned<T>::type(0x5555555555555555ull), typename detail::make_unsigned<T>::type( 1));
-		x = detail::compute_bitfieldBitCountStep<L, typename detail::make_unsigned<T>::type, Q, detail::is_aligned<Q>::value, sizeof(T) * 8>=  4>::call(x, typename detail::make_unsigned<T>::type(0x3333333333333333ull), typename detail::make_unsigned<T>::type( 2));
-		x = detail::compute_bitfieldBitCountStep<L, typename detail::make_unsigned<T>::type, Q, detail::is_aligned<Q>::value, sizeof(T) * 8>=  8>::call(x, typename detail::make_unsigned<T>::type(0x0F0F0F0F0F0F0F0Full), typename detail::make_unsigned<T>::type( 4));
-		x = detail::compute_bitfieldBitCountStep<L, typename detail::make_unsigned<T>::type, Q, detail::is_aligned<Q>::value, sizeof(T) * 8>= 16>::call(x, typename detail::make_unsigned<T>::type(0x00FF00FF00FF00FFull), typename detail::make_unsigned<T>::type( 8));
-		x = detail::compute_bitfieldBitCountStep<L, typename detail::make_unsigned<T>::type, Q, detail::is_aligned<Q>::value, sizeof(T) * 8>= 32>::call(x, typename detail::make_unsigned<T>::type(0x0000FFFF0000FFFFull), typename detail::make_unsigned<T>::type(16));
-		x = detail::compute_bitfieldBitCountStep<L, typename detail::make_unsigned<T>::type, Q, detail::is_aligned<Q>::value, sizeof(T) * 8>= 64>::call(x, typename detail::make_unsigned<T>::type(0x00000000FFFFFFFFull), typename detail::make_unsigned<T>::type(32));
+		vec<L, typename std::make_unsigned<T>::type, Q> x(v);
+		x = detail::compute_bitfieldBitCountStep<L, typename std::make_unsigned<T>::type, Q, detail::is_aligned<Q>::value, sizeof(T) * 8>=  2>::call(x, typename std::make_unsigned<T>::type(0x5555555555555555ull), typename std::make_unsigned<T>::type( 1));
+		x = detail::compute_bitfieldBitCountStep<L, typename std::make_unsigned<T>::type, Q, detail::is_aligned<Q>::value, sizeof(T) * 8>=  4>::call(x, typename std::make_unsigned<T>::type(0x3333333333333333ull), typename std::make_unsigned<T>::type( 2));
+		x = detail::compute_bitfieldBitCountStep<L, typename std::make_unsigned<T>::type, Q, detail::is_aligned<Q>::value, sizeof(T) * 8>=  8>::call(x, typename std::make_unsigned<T>::type(0x0F0F0F0F0F0F0F0Full), typename std::make_unsigned<T>::type( 4));
+		x = detail::compute_bitfieldBitCountStep<L, typename std::make_unsigned<T>::type, Q, detail::is_aligned<Q>::value, sizeof(T) * 8>= 16>::call(x, typename std::make_unsigned<T>::type(0x00FF00FF00FF00FFull), typename std::make_unsigned<T>::type( 8));
+		x = detail::compute_bitfieldBitCountStep<L, typename std::make_unsigned<T>::type, Q, detail::is_aligned<Q>::value, sizeof(T) * 8>= 32>::call(x, typename std::make_unsigned<T>::type(0x0000FFFF0000FFFFull), typename std::make_unsigned<T>::type(16));
+		x = detail::compute_bitfieldBitCountStep<L, typename std::make_unsigned<T>::type, Q, detail::is_aligned<Q>::value, sizeof(T) * 8>= 64>::call(x, typename std::make_unsigned<T>::type(0x00000000FFFFFFFFull), typename std::make_unsigned<T>::type(32));
 		return vec<L, int, Q>(x);
 
 #		if GLM_COMPILER & GLM_COMPILER_VC

+ 0 - 91
glm/detail/setup.hpp

@@ -640,97 +640,6 @@ namespace detail
 }//namespace detail
 }//namespace glm
 
-///////////////////////////////////////////////////////////////////////////////////
-// make_unsigned
-
-#if GLM_HAS_MAKE_SIGNED
-#	include <type_traits>
-
-namespace glm{
-namespace detail
-{
-	using std::make_unsigned;
-}//namespace detail
-}//namespace glm
-
-#else
-
-namespace glm{
-namespace detail
-{
-	template<typename genType>
-	struct make_unsigned
-	{};
-
-	template<>
-	struct make_unsigned<char>
-	{
-		typedef unsigned char type;
-	};
-
-	template<>
-	struct make_unsigned<signed char>
-	{
-		typedef unsigned char type;
-	};
-
-	template<>
-	struct make_unsigned<short>
-	{
-		typedef unsigned short type;
-	};
-
-	template<>
-	struct make_unsigned<int>
-	{
-		typedef unsigned int type;
-	};
-
-	template<>
-	struct make_unsigned<long>
-	{
-		typedef unsigned long type;
-	};
-
-	template<>
-	struct make_unsigned<int64>
-	{
-		typedef uint64 type;
-	};
-
-	template<>
-	struct make_unsigned<unsigned char>
-	{
-		typedef unsigned char type;
-	};
-
-	template<>
-	struct make_unsigned<unsigned short>
-	{
-		typedef unsigned short type;
-	};
-
-	template<>
-	struct make_unsigned<unsigned int>
-	{
-		typedef unsigned int type;
-	};
-
-	template<>
-	struct make_unsigned<unsigned long>
-	{
-		typedef unsigned long type;
-	};
-
-	template<>
-	struct make_unsigned<uint64>
-	{
-		typedef uint64 type;
-	};
-}//namespace detail
-}//namespace glm
-#endif
-
 ///////////////////////////////////////////////////////////////////////////////////
 // Only use x, y, z, w as vector type components
 

+ 7 - 7
test/core/core_func_integer.cpp

@@ -1449,13 +1449,13 @@ namespace bitCount
 	template<glm::length_t L, typename T, glm::qualifier Q>
 	static glm::vec<L, int, Q> bitCount_bitfield(glm::vec<L, T, Q> const& v)
 	{
-		glm::vec<L, typename glm::detail::make_unsigned<T>::type, Q> x(v);
-		x = compute_bitfieldBitCountStep<sizeof(T) * 8 >=  2>::call(x, static_cast<typename glm::detail::make_unsigned<T>::type>(0x5555555555555555ull), static_cast<typename glm::detail::make_unsigned<T>::type>( 1));
-		x = compute_bitfieldBitCountStep<sizeof(T) * 8 >=  4>::call(x, static_cast<typename glm::detail::make_unsigned<T>::type>(0x3333333333333333ull), static_cast<typename glm::detail::make_unsigned<T>::type>( 2));
-		x = compute_bitfieldBitCountStep<sizeof(T) * 8 >=  8>::call(x, static_cast<typename glm::detail::make_unsigned<T>::type>(0x0F0F0F0F0F0F0F0Full), static_cast<typename glm::detail::make_unsigned<T>::type>( 4));
-		x = compute_bitfieldBitCountStep<sizeof(T) * 8 >= 16>::call(x, static_cast<typename glm::detail::make_unsigned<T>::type>(0x00FF00FF00FF00FFull), static_cast<typename glm::detail::make_unsigned<T>::type>( 8));
-		x = compute_bitfieldBitCountStep<sizeof(T) * 8 >= 32>::call(x, static_cast<typename glm::detail::make_unsigned<T>::type>(0x0000FFFF0000FFFFull), static_cast<typename glm::detail::make_unsigned<T>::type>(16));
-		x = compute_bitfieldBitCountStep<sizeof(T) * 8 >= 64>::call(x, static_cast<typename glm::detail::make_unsigned<T>::type>(0x00000000FFFFFFFFull), static_cast<typename glm::detail::make_unsigned<T>::type>(32));
+		glm::vec<L, typename std::make_unsigned<T>::type, Q> x(v);
+		x = compute_bitfieldBitCountStep<sizeof(T) * 8 >=  2>::call(x, static_cast<typename std::make_unsigned<T>::type>(0x5555555555555555ull), static_cast<typename std::make_unsigned<T>::type>( 1));
+		x = compute_bitfieldBitCountStep<sizeof(T) * 8 >=  4>::call(x, static_cast<typename std::make_unsigned<T>::type>(0x3333333333333333ull), static_cast<typename std::make_unsigned<T>::type>( 2));
+		x = compute_bitfieldBitCountStep<sizeof(T) * 8 >=  8>::call(x, static_cast<typename std::make_unsigned<T>::type>(0x0F0F0F0F0F0F0F0Full), static_cast<typename std::make_unsigned<T>::type>( 4));
+		x = compute_bitfieldBitCountStep<sizeof(T) * 8 >= 16>::call(x, static_cast<typename std::make_unsigned<T>::type>(0x00FF00FF00FF00FFull), static_cast<typename std::make_unsigned<T>::type>( 8));
+		x = compute_bitfieldBitCountStep<sizeof(T) * 8 >= 32>::call(x, static_cast<typename std::make_unsigned<T>::type>(0x0000FFFF0000FFFFull), static_cast<typename std::make_unsigned<T>::type>(16));
+		x = compute_bitfieldBitCountStep<sizeof(T) * 8 >= 64>::call(x, static_cast<typename std::make_unsigned<T>::type>(0x00000000FFFFFFFFull), static_cast<typename std::make_unsigned<T>::type>(32));
 		return glm::vec<L, int, Q>(x);
 	}