Added GLM_HAS_MAKE_SIGNED for C++11 support of make_(un)signed
This commit is contained in:
@@ -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,56 +85,31 @@ 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;
|
||||||
|
|
||||||
|
# if GLM_HAS_MAKE_SIGNED
|
||||||
|
using std::make_signed;
|
||||||
|
using std::make_unsigned;
|
||||||
|
|
||||||
|
# else//GLM_HAS_MAKE_SIGNED
|
||||||
template <typename genType>
|
template <typename genType>
|
||||||
struct make_signed
|
struct make_signed
|
||||||
{};
|
{};
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct make_signed<int8>
|
struct make_signed<char>
|
||||||
{
|
{
|
||||||
typedef int8 type;
|
typedef char type;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct make_signed<uint8>
|
struct make_signed<short>
|
||||||
{
|
{
|
||||||
typedef int8 type;
|
typedef short type;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct make_signed<int16>
|
struct make_signed<int>
|
||||||
{
|
{
|
||||||
typedef int16 type;
|
typedef int type;
|
||||||
};
|
|
||||||
|
|
||||||
template <>
|
|
||||||
struct make_signed<uint16>
|
|
||||||
{
|
|
||||||
typedef int16 type;
|
|
||||||
};
|
|
||||||
|
|
||||||
template <>
|
|
||||||
struct make_signed<int32>
|
|
||||||
{
|
|
||||||
typedef int32 type;
|
|
||||||
};
|
|
||||||
|
|
||||||
template <>
|
|
||||||
struct make_signed<uint32>
|
|
||||||
{
|
|
||||||
typedef int32 type;
|
|
||||||
};
|
|
||||||
|
|
||||||
template <>
|
|
||||||
struct make_signed<int64>
|
|
||||||
{
|
|
||||||
typedef int64 type;
|
|
||||||
};
|
|
||||||
|
|
||||||
template <>
|
|
||||||
struct make_signed<uint64>
|
|
||||||
{
|
|
||||||
typedef int64 type;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
@@ -148,6 +124,24 @@ namespace detail
|
|||||||
typedef long long type;
|
typedef long long type;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template <>
|
||||||
|
struct make_signed<unsigned char>
|
||||||
|
{
|
||||||
|
typedef char type;
|
||||||
|
};
|
||||||
|
|
||||||
|
template <>
|
||||||
|
struct make_signed<unsigned short>
|
||||||
|
{
|
||||||
|
typedef short type;
|
||||||
|
};
|
||||||
|
|
||||||
|
template <>
|
||||||
|
struct make_signed<unsigned int>
|
||||||
|
{
|
||||||
|
typedef int type;
|
||||||
|
};
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct make_signed<unsigned long>
|
struct make_signed<unsigned long>
|
||||||
{
|
{
|
||||||
@@ -165,51 +159,21 @@ namespace detail
|
|||||||
{};
|
{};
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct make_unsigned<int8>
|
struct make_unsigned<char>
|
||||||
{
|
{
|
||||||
typedef uint8 type;
|
typedef unsigned char type;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct make_unsigned<uint8>
|
struct make_unsigned<short>
|
||||||
{
|
{
|
||||||
typedef uint8 type;
|
typedef unsigned short type;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <>
|
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>
|
|
||||||
{
|
|
||||||
typedef uint32 type;
|
|
||||||
};
|
|
||||||
|
|
||||||
template <>
|
|
||||||
struct make_unsigned<int64>
|
|
||||||
{
|
|
||||||
typedef uint64 type;
|
|
||||||
};
|
|
||||||
|
|
||||||
template <>
|
|
||||||
struct make_unsigned<uint64>
|
|
||||||
{
|
|
||||||
typedef uint64 type;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
@@ -224,6 +188,24 @@ namespace detail
|
|||||||
typedef unsigned long long type;
|
typedef unsigned long long 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 <>
|
template <>
|
||||||
struct make_unsigned<unsigned long>
|
struct make_unsigned<unsigned long>
|
||||||
{
|
{
|
||||||
@@ -235,6 +217,7 @@ namespace detail
|
|||||||
{
|
{
|
||||||
typedef unsigned long long type;
|
typedef unsigned long long type;
|
||||||
};
|
};
|
||||||
|
# endif//GLM_HAS_MAKE_SIGNED
|
||||||
}//namespace detail
|
}//namespace detail
|
||||||
|
|
||||||
typedef detail::int8 int8;
|
typedef detail::int8 int8;
|
||||||
|
|||||||
Reference in New Issue
Block a user