mirror of
https://github.com/g-truc/glm.git
synced 2026-06-08 02:23:48 +00:00
Remove integer C++11 workaround
This commit is contained in:
@@ -7,17 +7,6 @@
|
||||
#endif//(GLM_ARCH & GLM_ARCH_X86 && GLM_COMPILER & GLM_COMPILER_VC)
|
||||
#include <limits>
|
||||
|
||||
#if !GLM_HAS_EXTENDED_INTEGER_TYPE
|
||||
# if GLM_COMPILER & GLM_COMPILER_GCC
|
||||
# pragma GCC diagnostic push
|
||||
# pragma GCC diagnostic ignored "-Wlong-long"
|
||||
# endif
|
||||
# if (GLM_COMPILER & GLM_COMPILER_CLANG)
|
||||
# pragma clang diagnostic push
|
||||
# pragma clang diagnostic ignored "-Wc++11-long-long"
|
||||
# endif
|
||||
#endif
|
||||
|
||||
namespace glm{
|
||||
namespace detail
|
||||
{
|
||||
@@ -377,15 +366,6 @@ namespace detail
|
||||
}
|
||||
}//namespace glm
|
||||
|
||||
#if !GLM_HAS_EXTENDED_INTEGER_TYPE
|
||||
# if GLM_COMPILER & GLM_COMPILER_GCC
|
||||
# pragma GCC diagnostic pop
|
||||
# endif
|
||||
# if (GLM_COMPILER & GLM_COMPILER_CLANG)
|
||||
# pragma clang diagnostic pop
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if GLM_CONFIG_SIMD == GLM_ENABLE
|
||||
# include "func_integer_simd.inl"
|
||||
#endif
|
||||
|
||||
@@ -144,17 +144,6 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Has of C++ features
|
||||
|
||||
// N1988
|
||||
#if GLM_LANG & GLM_LANG_CXX11_FLAG
|
||||
# define GLM_HAS_EXTENDED_INTEGER_TYPE 1
|
||||
#else
|
||||
# define GLM_HAS_EXTENDED_INTEGER_TYPE (\
|
||||
((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_VC)) || \
|
||||
((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_CUDA)) || \
|
||||
((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_CLANG)) || \
|
||||
((GLM_COMPILER & GLM_COMPILER_HIP)))
|
||||
#endif
|
||||
|
||||
// N2672 Initializer lists http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2672.htm
|
||||
#if GLM_COMPILER & GLM_COMPILER_CLANG
|
||||
# define GLM_HAS_INITIALIZER_LISTS __has_feature(cxx_generalized_initializers)
|
||||
@@ -205,19 +194,6 @@
|
||||
((GLM_COMPILER & GLM_COMPILER_HIP))))
|
||||
#endif
|
||||
|
||||
// N2437 http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2437.pdf
|
||||
#if GLM_COMPILER & GLM_COMPILER_CLANG
|
||||
# define GLM_HAS_EXPLICIT_CONVERSION_OPERATORS __has_feature(cxx_explicit_conversions)
|
||||
#elif GLM_LANG & GLM_LANG_CXX11_FLAG
|
||||
# define GLM_HAS_EXPLICIT_CONVERSION_OPERATORS 1
|
||||
#else
|
||||
# define GLM_HAS_EXPLICIT_CONVERSION_OPERATORS ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (\
|
||||
((GLM_COMPILER & GLM_COMPILER_INTEL) && (GLM_COMPILER >= GLM_COMPILER_INTEL14)) || \
|
||||
((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC12)) || \
|
||||
((GLM_COMPILER & GLM_COMPILER_CUDA)) || \
|
||||
((GLM_COMPILER & GLM_COMPILER_HIP))))
|
||||
#endif
|
||||
|
||||
// N2258 http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2258.pdf
|
||||
#if GLM_COMPILER & GLM_COMPILER_CLANG
|
||||
# define GLM_HAS_TEMPLATE_ALIASES __has_feature(cxx_alias_templates)
|
||||
@@ -231,19 +207,6 @@
|
||||
((GLM_COMPILER & GLM_COMPILER_HIP))))
|
||||
#endif
|
||||
|
||||
// N2930 http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2009/n2930.html
|
||||
#if GLM_COMPILER & GLM_COMPILER_CLANG
|
||||
# define GLM_HAS_RANGE_FOR __has_feature(cxx_range_for)
|
||||
#elif GLM_LANG & GLM_LANG_CXX11_FLAG
|
||||
# define GLM_HAS_RANGE_FOR 1
|
||||
#else
|
||||
# define GLM_HAS_RANGE_FOR ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (\
|
||||
((GLM_COMPILER & GLM_COMPILER_INTEL)) || \
|
||||
((GLM_COMPILER & GLM_COMPILER_VC)) || \
|
||||
((GLM_COMPILER & GLM_COMPILER_CUDA)) || \
|
||||
((GLM_COMPILER & GLM_COMPILER_HIP))))
|
||||
#endif
|
||||
|
||||
// N2235 Generalized Constant Expressions http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2235.pdf
|
||||
// N3652 Extended Constant Expressions http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2013/n3652.html
|
||||
#if (GLM_ARCH & GLM_ARCH_SIMD_BIT) // Compiler SIMD intrinsics don't support constexpr...
|
||||
@@ -264,29 +227,6 @@
|
||||
# define GLM_CONSTEXPR
|
||||
#endif
|
||||
|
||||
//
|
||||
#if GLM_HAS_CONSTEXPR
|
||||
# if (GLM_COMPILER & GLM_COMPILER_CLANG)
|
||||
# if __has_feature(cxx_if_constexpr)
|
||||
# define GLM_HAS_IF_CONSTEXPR 1
|
||||
# else
|
||||
# define GLM_HAS_IF_CONSTEXPR 0
|
||||
# endif
|
||||
# elif (GLM_LANG & GLM_LANG_CXX17_FLAG)
|
||||
# define GLM_HAS_IF_CONSTEXPR 1
|
||||
# else
|
||||
# define GLM_HAS_IF_CONSTEXPR 0
|
||||
# endif
|
||||
#else
|
||||
# define GLM_HAS_IF_CONSTEXPR 0
|
||||
#endif
|
||||
|
||||
#if GLM_HAS_IF_CONSTEXPR
|
||||
# define GLM_IF_CONSTEXPR if constexpr
|
||||
#else
|
||||
# define GLM_IF_CONSTEXPR if
|
||||
#endif
|
||||
|
||||
// [nodiscard]
|
||||
#if GLM_LANG & GLM_LANG_CXX17_FLAG
|
||||
# define GLM_NODISCARD [[nodiscard]]
|
||||
@@ -294,16 +234,6 @@
|
||||
# define GLM_NODISCARD
|
||||
#endif
|
||||
|
||||
//
|
||||
#if GLM_LANG & GLM_LANG_CXX11_FLAG
|
||||
# define GLM_HAS_MAKE_SIGNED 1
|
||||
#else
|
||||
# define GLM_HAS_MAKE_SIGNED ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (\
|
||||
((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC12)) || \
|
||||
((GLM_COMPILER & GLM_COMPILER_CUDA)) || \
|
||||
((GLM_COMPILER & GLM_COMPILER_HIP))))
|
||||
#endif
|
||||
|
||||
//
|
||||
#if defined(GLM_FORCE_INTRINSICS)
|
||||
# define GLM_HAS_BITSCAN_WINDOWS ((GLM_PLATFORM & GLM_PLATFORM_WINDOWS) && (\
|
||||
@@ -581,9 +511,22 @@ namespace glm
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// uint
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
|
||||
namespace glm{
|
||||
namespace detail
|
||||
{
|
||||
typedef std::int8_t int8;
|
||||
typedef std::int16_t int16;
|
||||
typedef std::int32_t int32;
|
||||
typedef std::int64_t int64;
|
||||
|
||||
typedef std::uint8_t uint8;
|
||||
typedef std::uint16_t uint16;
|
||||
typedef std::uint32_t uint32;
|
||||
typedef std::uint64_t uint64;
|
||||
|
||||
template<typename T>
|
||||
struct is_int
|
||||
{
|
||||
@@ -591,13 +534,49 @@ namespace detail
|
||||
};
|
||||
|
||||
template<>
|
||||
struct is_int<unsigned int>
|
||||
struct is_int<int8>
|
||||
{
|
||||
enum test {value = ~0};
|
||||
};
|
||||
|
||||
template<>
|
||||
struct is_int<signed int>
|
||||
struct is_int<int16>
|
||||
{
|
||||
enum test {value = ~0};
|
||||
};
|
||||
|
||||
template<>
|
||||
struct is_int<int32>
|
||||
{
|
||||
enum test {value = ~0};
|
||||
};
|
||||
|
||||
template<>
|
||||
struct is_int<int64>
|
||||
{
|
||||
enum test {value = ~0};
|
||||
};
|
||||
|
||||
template<>
|
||||
struct is_int<uint8>
|
||||
{
|
||||
enum test {value = ~0};
|
||||
};
|
||||
|
||||
template<>
|
||||
struct is_int<uint16>
|
||||
{
|
||||
enum test {value = ~0};
|
||||
};
|
||||
|
||||
template<>
|
||||
struct is_int<uint32>
|
||||
{
|
||||
enum test {value = ~0};
|
||||
};
|
||||
|
||||
template<>
|
||||
struct is_int<uint64>
|
||||
{
|
||||
enum test {value = ~0};
|
||||
};
|
||||
@@ -606,19 +585,6 @@ namespace detail
|
||||
typedef unsigned int uint;
|
||||
}//namespace glm
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// 64-bit int
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
namespace glm{
|
||||
namespace detail
|
||||
{
|
||||
typedef std::uint64_t uint64;
|
||||
typedef std::int64_t int64;
|
||||
}//namespace detail
|
||||
}//namespace glm
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Only use x, y, z, w as vector type components
|
||||
|
||||
|
||||
@@ -92,11 +92,8 @@ namespace glm
|
||||
template<typename U, qualifier P>
|
||||
GLM_CTOR_DECL GLM_EXPLICIT qua(qua<U, P> const& q);
|
||||
|
||||
/// Explicit conversion operators
|
||||
# if GLM_HAS_EXPLICIT_CONVERSION_OPERATORS
|
||||
GLM_FUNC_DECL explicit operator mat<3, 3, T, Q>() const;
|
||||
GLM_FUNC_DECL explicit operator mat<4, 4, T, Q>() const;
|
||||
# endif
|
||||
GLM_FUNC_DECL explicit operator mat<3, 3, T, Q>() const;
|
||||
GLM_FUNC_DECL explicit operator mat<4, 4, T, Q>() const;
|
||||
|
||||
/// Create a quaternion from two normalized axis
|
||||
///
|
||||
|
||||
@@ -240,7 +240,6 @@ namespace detail
|
||||
*this = quat_cast(m);
|
||||
}
|
||||
|
||||
# if GLM_HAS_EXPLICIT_CONVERSION_OPERATORS
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER qua<T, Q>::operator mat<3, 3, T, Q>() const
|
||||
{
|
||||
@@ -252,7 +251,6 @@ namespace detail
|
||||
{
|
||||
return mat4_cast(*this);
|
||||
}
|
||||
# endif//GLM_HAS_EXPLICIT_CONVERSION_OPERATORS
|
||||
|
||||
// -- Unary arithmetic operators --
|
||||
|
||||
|
||||
@@ -214,11 +214,7 @@
|
||||
#include "./gtx/functions.hpp"
|
||||
#include "./gtx/gradient_paint.hpp"
|
||||
#include "./gtx/handed_coordinate_space.hpp"
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
#include "./gtx/hash.hpp"
|
||||
#endif
|
||||
|
||||
#include "./gtx/integer.hpp"
|
||||
#include "./gtx/intersect.hpp"
|
||||
#include "./gtx/io.hpp"
|
||||
@@ -260,8 +256,5 @@
|
||||
#if GLM_HAS_TEMPLATE_ALIASES
|
||||
# include "./gtx/scalar_multiplication.hpp"
|
||||
#endif
|
||||
|
||||
#if GLM_HAS_RANGE_FOR
|
||||
# include "./gtx/range.hpp"
|
||||
#endif
|
||||
#include "./gtx/range.hpp"
|
||||
#endif//GLM_ENABLE_EXPERIMENTAL
|
||||
|
||||
@@ -19,38 +19,6 @@
|
||||
#endif
|
||||
|
||||
namespace glm{
|
||||
namespace detail
|
||||
{
|
||||
# if GLM_HAS_EXTENDED_INTEGER_TYPE
|
||||
typedef std::int8_t int8;
|
||||
typedef std::int16_t int16;
|
||||
typedef std::int32_t int32;
|
||||
# else
|
||||
typedef signed char int8;
|
||||
typedef signed short int16;
|
||||
typedef signed int int32;
|
||||
#endif//
|
||||
|
||||
template<>
|
||||
struct is_int<int8>
|
||||
{
|
||||
enum test {value = ~0};
|
||||
};
|
||||
|
||||
template<>
|
||||
struct is_int<int16>
|
||||
{
|
||||
enum test {value = ~0};
|
||||
};
|
||||
|
||||
template<>
|
||||
struct is_int<int64>
|
||||
{
|
||||
enum test {value = ~0};
|
||||
};
|
||||
}//namespace detail
|
||||
|
||||
|
||||
/// @addtogroup ext_scalar_int_sized
|
||||
/// @{
|
||||
|
||||
|
||||
@@ -19,38 +19,6 @@
|
||||
#endif
|
||||
|
||||
namespace glm{
|
||||
namespace detail
|
||||
{
|
||||
# if GLM_HAS_EXTENDED_INTEGER_TYPE
|
||||
typedef std::uint8_t uint8;
|
||||
typedef std::uint16_t uint16;
|
||||
typedef std::uint32_t uint32;
|
||||
# else
|
||||
typedef unsigned char uint8;
|
||||
typedef unsigned short uint16;
|
||||
typedef unsigned int uint32;
|
||||
#endif
|
||||
|
||||
template<>
|
||||
struct is_int<uint8>
|
||||
{
|
||||
enum test {value = ~0};
|
||||
};
|
||||
|
||||
template<>
|
||||
struct is_int<uint16>
|
||||
{
|
||||
enum test {value = ~0};
|
||||
};
|
||||
|
||||
template<>
|
||||
struct is_int<uint64>
|
||||
{
|
||||
enum test {value = ~0};
|
||||
};
|
||||
}//namespace detail
|
||||
|
||||
|
||||
/// @addtogroup ext_scalar_uint_sized
|
||||
/// @{
|
||||
|
||||
|
||||
12
glm/fwd.hpp
12
glm/fwd.hpp
@@ -4,7 +4,6 @@
|
||||
|
||||
namespace glm
|
||||
{
|
||||
#if GLM_HAS_EXTENDED_INTEGER_TYPE
|
||||
typedef std::int8_t int8;
|
||||
typedef std::int16_t int16;
|
||||
typedef std::int32_t int32;
|
||||
@@ -14,17 +13,6 @@ namespace glm
|
||||
typedef std::uint16_t uint16;
|
||||
typedef std::uint32_t uint32;
|
||||
typedef std::uint64_t uint64;
|
||||
#else
|
||||
typedef signed char int8;
|
||||
typedef signed short int16;
|
||||
typedef signed int int32;
|
||||
typedef detail::int64 int64;
|
||||
|
||||
typedef unsigned char uint8;
|
||||
typedef unsigned short uint16;
|
||||
typedef unsigned int uint32;
|
||||
typedef detail::uint64 uint64;
|
||||
#endif
|
||||
|
||||
// Scalar int
|
||||
|
||||
|
||||
@@ -2214,11 +2214,9 @@ export namespace glm {
|
||||
using glm::operator*;
|
||||
using glm::operator/;
|
||||
# endif
|
||||
# if GLM_HAS_RANGE_FOR
|
||||
using glm::components;
|
||||
using glm::begin;
|
||||
using glm::end;
|
||||
# endif
|
||||
|
||||
using glm::abs;
|
||||
using glm::acos;
|
||||
|
||||
@@ -195,29 +195,21 @@ namespace glm
|
||||
/// @see gtc_type_precision
|
||||
typedef detail::int64 highp_i64;
|
||||
|
||||
|
||||
#if GLM_HAS_EXTENDED_INTEGER_TYPE
|
||||
using std::int8_t;
|
||||
using std::int16_t;
|
||||
using std::int32_t;
|
||||
using std::int64_t;
|
||||
#else
|
||||
/// 8 bit signed integer type.
|
||||
/// @see gtc_type_precision
|
||||
typedef detail::int8 int8_t;
|
||||
using std::int8_t;
|
||||
|
||||
/// 16 bit signed integer type.
|
||||
/// @see gtc_type_precision
|
||||
typedef detail::int16 int16_t;
|
||||
using std::int16_t;
|
||||
|
||||
/// 32 bit signed integer type.
|
||||
/// @see gtc_type_precision
|
||||
typedef detail::int32 int32_t;
|
||||
using std::int32_t;
|
||||
|
||||
/// 64 bit signed integer type.
|
||||
/// @see gtc_type_precision
|
||||
typedef detail::int64 int64_t;
|
||||
#endif
|
||||
using std::int64_t;
|
||||
|
||||
/// 8 bit signed integer type.
|
||||
/// @see gtc_type_precision
|
||||
@@ -382,28 +374,21 @@ namespace glm
|
||||
/// @see gtc_type_precision
|
||||
typedef detail::uint64 highp_u64;
|
||||
|
||||
#if GLM_HAS_EXTENDED_INTEGER_TYPE
|
||||
using std::uint8_t;
|
||||
using std::uint16_t;
|
||||
using std::uint32_t;
|
||||
using std::uint64_t;
|
||||
#else
|
||||
/// Default qualifier 8 bit unsigned integer type.
|
||||
/// @see gtc_type_precision
|
||||
typedef detail::uint8 uint8_t;
|
||||
using std::uint8_t;
|
||||
|
||||
/// Default qualifier 16 bit unsigned integer type.
|
||||
/// @see gtc_type_precision
|
||||
typedef detail::uint16 uint16_t;
|
||||
using std::uint16_t;
|
||||
|
||||
/// Default qualifier 32 bit unsigned integer type.
|
||||
/// @see gtc_type_precision
|
||||
typedef detail::uint32 uint32_t;
|
||||
using std::uint32_t;
|
||||
|
||||
/// Default qualifier 64 bit unsigned integer type.
|
||||
/// @see gtc_type_precision
|
||||
typedef detail::uint64 uint64_t;
|
||||
#endif
|
||||
using std::uint64_t;
|
||||
|
||||
/// Default qualifier 8 bit unsigned integer type.
|
||||
/// @see gtc_type_precision
|
||||
|
||||
@@ -3,8 +3,6 @@
|
||||
#include <glm/ext/vector_relational.hpp>
|
||||
#include <glm/glm.hpp>
|
||||
|
||||
#if GLM_HAS_RANGE_FOR
|
||||
|
||||
#define GLM_ENABLE_EXPERIMENTAL
|
||||
#include <glm/gtx/range.hpp>
|
||||
|
||||
@@ -73,11 +71,3 @@ int main()
|
||||
return Error;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
int main()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif//GLM_HAS_RANGE_FOR
|
||||
|
||||
Reference in New Issue
Block a user