diff --git a/glm/detail/setup.hpp b/glm/detail/setup.hpp index dc4e92c6..8f52348c 100644 --- a/glm/detail/setup.hpp +++ b/glm/detail/setup.hpp @@ -535,6 +535,10 @@ ((GLM_LANG & GLM_LANG_CXX11_FLAG) && !(GLM_COMPILER & GLM_COMPILER_GCC)) || \ ((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC12))) +#define GLM_HAS_MAKE_SIGNED (\ + (GLM_LANG & GLM_LANG_CXX11_FLAG) || \ + ((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC12))) + // OpenMP #ifdef _OPENMP # if GLM_COMPILER & GLM_COMPILER_GCC diff --git a/glm/detail/type_int.hpp b/glm/detail/type_int.hpp index b6f93fee..26dc6ac6 100644 --- a/glm/detail/type_int.hpp +++ b/glm/detail/type_int.hpp @@ -29,6 +29,7 @@ #pragma once #include "setup.hpp" +#include #if GLM_HAS_EXTENDED_INTEGER_TYPE # include @@ -84,157 +85,139 @@ namespace detail typedef unsigned int mediump_uint_t; typedef unsigned int highp_uint_t; - template - struct make_signed - {}; - - template <> - struct make_signed - { - typedef int8 type; - }; - - template <> - struct make_signed - { - typedef int8 type; - }; - - template <> - struct make_signed - { - typedef int16 type; - }; - - template <> - struct make_signed - { - typedef int16 type; - }; - - template <> - struct make_signed - { - typedef int32 type; - }; - - template <> - struct make_signed - { - typedef int32 type; - }; - - template <> - struct make_signed - { - typedef int64 type; - }; - - template <> - struct make_signed - { - typedef int64 type; - }; - - template <> - struct make_signed - { - typedef long type; - }; - - template <> - struct make_signed - { - typedef long long type; - }; - - template <> - struct make_signed - { - typedef long type; - }; - - template <> - struct make_signed - { - typedef long long type; - }; - - template - struct make_unsigned - {}; - - template <> - struct make_unsigned - { - typedef uint8 type; - }; - - template <> - struct make_unsigned - { - typedef uint8 type; - }; - - template <> - struct make_unsigned - { - typedef uint16 type; - }; - - template <> - struct make_unsigned - { - typedef uint16 type; - }; - - template <> - struct make_unsigned - { - typedef uint32 type; - }; - - template <> - struct make_unsigned - { - typedef uint32 type; - }; - - template <> - struct make_unsigned - { - typedef uint64 type; - }; - - template <> - struct make_unsigned - { - typedef uint64 type; - }; - - template <> - struct make_unsigned - { - typedef unsigned long type; - }; - - template <> - struct make_unsigned - { - typedef unsigned long long type; - }; - - template <> - struct make_unsigned - { - typedef unsigned long type; - }; - - template <> - struct make_unsigned - { - typedef unsigned long long type; - }; +# if GLM_HAS_MAKE_SIGNED + using std::make_signed; + using std::make_unsigned; + +# else//GLM_HAS_MAKE_SIGNED + template + struct make_signed + {}; + + template <> + struct make_signed + { + typedef char type; + }; + + template <> + struct make_signed + { + typedef short type; + }; + + template <> + struct make_signed + { + typedef int type; + }; + + template <> + struct make_signed + { + typedef long type; + }; + + template <> + struct make_signed + { + typedef long long type; + }; + + template <> + struct make_signed + { + typedef char type; + }; + + template <> + struct make_signed + { + typedef short type; + }; + + template <> + struct make_signed + { + typedef int type; + }; + + template <> + struct make_signed + { + typedef long type; + }; + + template <> + struct make_signed + { + typedef long long type; + }; + + template + struct make_unsigned + {}; + + 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 unsigned long long 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 unsigned long long type; + }; +# endif//GLM_HAS_MAKE_SIGNED }//namespace detail typedef detail::int8 int8;