From 0f369ff3a939a559f179e567049c7bc9f0967aec Mon Sep 17 00:00:00 2001 From: twinaphex Date: Thu, 3 Nov 2016 12:51:26 +0100 Subject: [PATCH] (GLM) Get rid of GLM_STATIC_ASSERT entirely --- deps/glm/detail/func_integer.inl | 38 -------------------------------- deps/glm/detail/func_matrix.inl | 6 ----- deps/glm/detail/setup.hpp | 21 ------------------ deps/glm/detail/type_float.hpp | 8 ------- deps/glm/detail/type_int.hpp | 15 ------------- 5 files changed, 88 deletions(-) diff --git a/deps/glm/detail/func_integer.inl b/deps/glm/detail/func_integer.inl index a57de79407..e03353c0a7 100644 --- a/deps/glm/detail/func_integer.inl +++ b/deps/glm/detail/func_integer.inl @@ -107,8 +107,6 @@ namespace glm uint & Borrow ) { - GLM_STATIC_ASSERT(sizeof(uint) == sizeof(uint32), "uint and uint32 size mismatch"); - Borrow = x >= y ? static_cast(0) : static_cast(1); if(y >= x) return y - x; @@ -167,8 +165,6 @@ namespace glm uint & lsb ) { - GLM_STATIC_ASSERT(sizeof(uint) == sizeof(uint32), "uint and uint32 size mismatch"); - uint64 Value64 = static_cast(x) * static_cast(y); msb = Value64 >> 32; lsb = Value64; @@ -226,8 +222,6 @@ namespace glm int & lsb ) { - GLM_STATIC_ASSERT(sizeof(int) == sizeof(int32), "int and int32 size mismatch"); - int64 Value64 = static_cast(x) * static_cast(y); msb = Value64 >> 32; lsb = Value64; @@ -346,7 +340,6 @@ namespace glm int const & Bits ) { - GLM_STATIC_ASSERT(std::numeric_limits::is_integer, "'bitfieldInsert' only accept integer values"); assert(Offset + Bits <= sizeof(genIUType)); if(Bits == 0) @@ -408,8 +401,6 @@ namespace glm template GLM_FUNC_QUALIFIER genIUType bitfieldReverse(genIUType const & Value) { - GLM_STATIC_ASSERT(std::numeric_limits::is_integer, "'bitfieldReverse' only accept integer values"); - genIUType Out = 0; std::size_t BitSize = sizeof(genIUType) * 8; for(std::size_t i = 0; i < BitSize; ++i) @@ -424,8 +415,6 @@ namespace glm template GLM_FUNC_QUALIFIER int bitCount(genIUType const & Value) { - GLM_STATIC_ASSERT(std::numeric_limits::is_integer, "'bitCount' only accept integer values"); - int Count = 0; for(std::size_t i = 0; i < sizeof(genIUType) * std::size_t(8); ++i) { @@ -478,7 +467,6 @@ namespace glm genIUType const & Value ) { - GLM_STATIC_ASSERT(std::numeric_limits::is_integer, "'findLSB' only accept integer values"); if(Value == 0) return -1; @@ -532,7 +520,6 @@ namespace glm genIUType const & Value ) { - GLM_STATIC_ASSERT(std::numeric_limits::is_integer, "'findMSB' only accept integer values"); if(Value == 0) return -1; @@ -540,29 +527,6 @@ namespace glm _BitScanReverse(&Result, Value); return int(Result); } -/* -// __builtin_clz seems to be buggy as it crasks for some values, from 0x00200000 to 80000000 -#elif((GLM_ARCH != GLM_ARCH_PURE) && (GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC40)) - - template - GLM_FUNC_QUALIFIER int findMSB - ( - genIUType const & Value - ) - { - GLM_STATIC_ASSERT(std::numeric_limits::is_integer, "'findMSB' only accept integer values"); - if(Value == 0) - return -1; - - // clz returns the number or trailing 0-bits; see - // http://gcc.gnu.org/onlinedocs/gcc-4.7.1/gcc/Other-Builtins.html - // - // NoteBecause __builtin_clz only works for unsigned ints, this - // implementation will not work for 64-bit integers. - // - return 31 - __builtin_clzl(Value); - } -*/ #else /* SSE implementation idea @@ -589,8 +553,6 @@ namespace glm genIUType const & Value ) { - GLM_STATIC_ASSERT(std::numeric_limits::is_integer, "'findMSB' only accept integer values"); - if(Value == genIUType(0) || Value == genIUType(-1)) return -1; else if(Value > 0) diff --git a/deps/glm/detail/func_matrix.inl b/deps/glm/detail/func_matrix.inl index c21882da93..6c58fadd9f 100644 --- a/deps/glm/detail/func_matrix.inl +++ b/deps/glm/detail/func_matrix.inl @@ -421,8 +421,6 @@ namespace detail template class matType> GLM_FUNC_QUALIFIER matType matrixCompMult(matType const & x, matType const & y) { - GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'matrixCompMult' only accept floating-point inputs"); - matType result(matType::_null); for(length_t i = 0; i < result.length(); ++i) result[i] = x[i] * y[i]; @@ -432,28 +430,24 @@ namespace detail template class vecTypeA, template class vecTypeB> GLM_FUNC_QUALIFIER typename detail::outerProduct_trait::type outerProduct(vecTypeA const & c, vecTypeB const & r) { - GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'outerProduct' only accept floating-point inputs"); return detail::compute_outerProduct::call(c, r); } template class matType> GLM_FUNC_QUALIFIER typename matType::transpose_type transpose(matType const & m) { - GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'transpose' only accept floating-point inputs"); return detail::compute_transpose::call(m); } template class matType> GLM_FUNC_QUALIFIER T determinant(matType const & m) { - GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'determinant' only accept floating-point inputs"); return detail::compute_determinant::call(m); } template class matType> GLM_FUNC_QUALIFIER matType inverse(matType const & m) { - GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'inverse' only accept floating-point inputs"); return detail::compute_inverse::call(m); } diff --git a/deps/glm/detail/setup.hpp b/deps/glm/detail/setup.hpp index 610b3ddb93..dc4b5ef785 100644 --- a/deps/glm/detail/setup.hpp +++ b/deps/glm/detail/setup.hpp @@ -486,13 +486,6 @@ // http://gcc.gnu.org/projects/cxx0x.html // http://msdn.microsoft.com/en-us/library/vstudio/hh567368(v=vs.120).aspx -// N1720 -#define GLM_HAS_STATIC_ASSERT ( \ - (GLM_LANG & GLM_LANG_CXX11_FLAG) || \ - ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC10)) || \ - ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC43)) || \ - __has_feature(cxx_static_assert)) - // N1988 #define GLM_HAS_EXTENDED_INTEGER_TYPE ( \ (GLM_LANG & GLM_LANG_CXX11_FLAG) || \ @@ -612,20 +605,6 @@ //#define GLM_FORCE_RADIANS -/////////////////////////////////////////////////////////////////////////////////////////////////// -// Static assert - -#if GLM_HAS_STATIC_ASSERT -# define GLM_STATIC_ASSERT(x, message) static_assert(x, message) -#elif(defined(BOOST_STATIC_ASSERT)) -# define GLM_STATIC_ASSERT(x, message) BOOST_STATIC_ASSERT(x) -#elif(GLM_COMPILER & GLM_COMPILER_VC) -# define GLM_STATIC_ASSERT(x, message) typedef char __CASSERT__##__LINE__[(x) ? 1 : -1] -#else -# define GLM_STATIC_ASSERT(x, message) -# define GLM_STATIC_ASSERT_NULL -#endif//GLM_LANG - /////////////////////////////////////////////////////////////////////////////////////////////////// // Qualifiers diff --git a/deps/glm/detail/type_float.hpp b/deps/glm/detail/type_float.hpp index 2175d4cb3c..751e494def 100644 --- a/deps/glm/detail/type_float.hpp +++ b/deps/glm/detail/type_float.hpp @@ -80,14 +80,6 @@ namespace detail typedef float float32; typedef double float64; - -//////////////////// -// check type sizes -#ifndef GLM_STATIC_ASSERT_NULL - GLM_STATIC_ASSERT(sizeof(glm::float32) == 4, "float32 size isn't 4 bytes on this platform"); - GLM_STATIC_ASSERT(sizeof(glm::float64) == 8, "float64 size isn't 8 bytes on this platform"); -#endif//GLM_STATIC_ASSERT_NULL - /// @} }//namespace glm diff --git a/deps/glm/detail/type_int.hpp b/deps/glm/detail/type_int.hpp index 4caf3d17af..aeac6ac281 100644 --- a/deps/glm/detail/type_int.hpp +++ b/deps/glm/detail/type_int.hpp @@ -171,21 +171,6 @@ namespace detail typedef unsigned int uint; /// @} - -//////////////////// -// check type sizes -#ifndef GLM_STATIC_ASSERT_NULL - GLM_STATIC_ASSERT(sizeof(glm::int8) == 1, "int8 size isn't 1 byte on this platform"); - GLM_STATIC_ASSERT(sizeof(glm::int16) == 2, "int16 size isn't 2 bytes on this platform"); - GLM_STATIC_ASSERT(sizeof(glm::int32) == 4, "int32 size isn't 4 bytes on this platform"); - GLM_STATIC_ASSERT(sizeof(glm::int64) == 8, "int64 size isn't 8 bytes on this platform"); - - GLM_STATIC_ASSERT(sizeof(glm::uint8) == 1, "uint8 size isn't 1 byte on this platform"); - GLM_STATIC_ASSERT(sizeof(glm::uint16) == 2, "uint16 size isn't 2 bytes on this platform"); - GLM_STATIC_ASSERT(sizeof(glm::uint32) == 4, "uint32 size isn't 4 bytes on this platform"); - GLM_STATIC_ASSERT(sizeof(glm::uint64) == 8, "uint64 size isn't 8 bytes on this platform"); -#endif//GLM_STATIC_ASSERT_NULL - }//namespace glm #endif//glm_core_type_int