Added GLM_HAS_MAKE_SIGNED for C++11 support of make_(un)signed

master
Christophe Riccio ago%!(EXTRA string=11 years)
parent de5dd23d2f
commit 8d9c4596b3
  1. 4
      glm/detail/setup.hpp
  2. 285
      glm/detail/type_int.hpp

@ -535,6 +535,10 @@
((GLM_LANG & GLM_LANG_CXX11_FLAG) && !(GLM_COMPILER & GLM_COMPILER_GCC)) || \ ((GLM_LANG & GLM_LANG_CXX11_FLAG) && !(GLM_COMPILER & GLM_COMPILER_GCC)) || \
((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC12))) ((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 // OpenMP
#ifdef _OPENMP #ifdef _OPENMP
# if GLM_COMPILER & GLM_COMPILER_GCC # if GLM_COMPILER & GLM_COMPILER_GCC

@ -29,6 +29,7 @@
#pragma once #pragma once
#include "setup.hpp" #include "setup.hpp"
#include <type_traits>
#if GLM_HAS_EXTENDED_INTEGER_TYPE #if GLM_HAS_EXTENDED_INTEGER_TYPE
# include <cstdint> # include <cstdint>
@ -84,157 +85,139 @@ namespace detail
typedef unsigned int mediump_uint_t; typedef unsigned int mediump_uint_t;
typedef unsigned int highp_uint_t; typedef unsigned int highp_uint_t;
template <typename genType> # if GLM_HAS_MAKE_SIGNED
struct make_signed using std::make_signed;
{}; using std::make_unsigned;
template <> # else//GLM_HAS_MAKE_SIGNED
struct make_signed<int8> template <typename genType>
{ struct make_signed
typedef int8 type; {};
};
template <>
template <> struct make_signed<char>
struct make_signed<uint8> {
{ typedef char type;
typedef int8 type; };
};
template <>
template <> struct make_signed<short>
struct make_signed<int16> {
{ typedef short type;
typedef int16 type; };
};
template <>
template <> struct make_signed<int>
struct make_signed<uint16> {
{ typedef int type;
typedef int16 type; };
};
template <>
template <> struct make_signed<long>
struct make_signed<int32> {
{ typedef long type;
typedef int32 type; };
};
template <>
template <> struct make_signed<long long>
struct make_signed<uint32> {
{ typedef long long type;
typedef int32 type; };
};
template <>
template <> struct make_signed<unsigned char>
struct make_signed<int64> {
{ typedef char type;
typedef int64 type; };
};
template <>
template <> struct make_signed<unsigned short>
struct make_signed<uint64> {
{ typedef short type;
typedef int64 type; };
};
template <>
template <> struct make_signed<unsigned int>
struct make_signed<long> {
{ typedef int type;
typedef long type; };
};
template <>
template <> struct make_signed<unsigned long>
struct make_signed<long long> {
{ typedef long type;
typedef long long type; };
};
template <>
template <> struct make_signed<unsigned long long>
struct make_signed<unsigned long> {
{ typedef long long type;
typedef long type; };
};
template <typename genType>
template <> struct make_unsigned
struct make_signed<unsigned long long> {};
{
typedef long long type; template <>
}; struct make_unsigned<char>
{
template <typename genType> typedef unsigned char type;
struct make_unsigned };
{};
template <>
template <> struct make_unsigned<short>
struct make_unsigned<int8> {
{ typedef unsigned short type;
typedef uint8 type; };
};
template <>
template <> struct make_unsigned<int>
struct make_unsigned<uint8> {
{ typedef unsigned int type;
typedef uint8 type; };
};
template <>
template <> struct make_unsigned<long>
struct make_unsigned<int16> {
{ typedef unsigned long type;
typedef uint16 type; };
};
template <>
template <> struct make_unsigned<long long>
struct make_unsigned<uint16> {
{ typedef unsigned long long type;
typedef uint16 type; };
};
template <>
template <> struct make_unsigned<unsigned char>
struct make_unsigned<int32> {
{ typedef unsigned char type;
typedef uint32 type; };
};
template <>
template <> struct make_unsigned<unsigned short>
struct make_unsigned<uint32> {
{ typedef unsigned short type;
typedef uint32 type; };
};
template <>
template <> struct make_unsigned<unsigned int>
struct make_unsigned<int64> {
{ typedef unsigned int type;
typedef uint64 type; };
};
template <>
template <> struct make_unsigned<unsigned long>
struct make_unsigned<uint64> {
{ typedef unsigned long type;
typedef uint64 type; };
};
template <>
template <> struct make_unsigned<unsigned long long>
struct make_unsigned<long> {
{ typedef unsigned long long type;
typedef unsigned long type; };
}; # endif//GLM_HAS_MAKE_SIGNED
template <>
struct make_unsigned<long long>
{
typedef unsigned long long type;
};
template <>
struct make_unsigned<unsigned long>
{
typedef unsigned long type;
};
template <>
struct make_unsigned<unsigned long long>
{
typedef unsigned long long type;
};
}//namespace detail }//namespace detail
typedef detail::int8 int8; typedef detail::int8 int8;

Loading…
Cancel
Save