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

This commit is contained in:
Christophe Riccio 2014-11-15 23:31:13 +01:00
parent de5dd23d2f
commit 8d9c4596b3
2 changed files with 116 additions and 129 deletions

View File

@ -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

View File

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