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. 95
      glm/detail/type_int.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

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

Loading…
Cancel
Save