From 96ef6ae9ba5ec7c1d4544478fbd464c53fd7411c Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Mon, 4 Aug 2014 01:00:49 +0200 Subject: [PATCH 1/2] Fixed infinite loop in isfinite function with GCC #221 --- glm/gtx/compatibility.inl | 4 +++- readme.txt | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/glm/gtx/compatibility.inl b/glm/gtx/compatibility.inl index d08ffb82..e50f3df6 100644 --- a/glm/gtx/compatibility.inl +++ b/glm/gtx/compatibility.inl @@ -7,6 +7,8 @@ // File : glm/gtx/compatibility.inl /////////////////////////////////////////////////////////////////////////////////////////////////// +#include + namespace glm { // isfinite @@ -21,7 +23,7 @@ namespace glm # elif(GLM_COMPILER & GLM_COMPILER_GCC && GLM_PLATFORM & GLM_PLATFORM_ANDROID) return _isfinite(x) != 0; # else - return isfinite(x) != 0; + return x >= std::numeric_limits::min() && x <= std::numeric_limits::max(); # endif } diff --git a/readme.txt b/readme.txt index 5320c51d..f1214670 100644 --- a/readme.txt +++ b/readme.txt @@ -42,6 +42,7 @@ GLM 0.9.5.5: 2014-XX-XX - Fixed std::nextafter not supported with C++11 on Android #213 - Fixed missing value_type for dual quaternion - Fixed return type of dual quaternion length +- Fixed infinite loop in isfinite function with GCC #221 ================================================================================ GLM 0.9.5.4: 2014-06-21 From f916339ca7722389d4eb560e885180f5b73e6351 Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Mon, 4 Aug 2014 01:18:34 +0200 Subject: [PATCH 2/2] Rely on C++11 to implement isinf and isnan --- glm/detail/func_common.inl | 12 +++++++----- readme.txt | 1 + 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/glm/detail/func_common.inl b/glm/detail/func_common.inl index 4026e0c8..814b0a93 100644 --- a/glm/detail/func_common.inl +++ b/glm/detail/func_common.inl @@ -713,7 +713,9 @@ namespace detail std::numeric_limits::is_iec559, "'isnan' only accept floating-point inputs"); -# if(GLM_COMPILER & (GLM_COMPILER_VC | GLM_COMPILER_INTEL)) +# if(GLM_LANG & GLM_LANG_CXX11_FLAG) + return std::isnan(x); +# elif(GLM_COMPILER & (GLM_COMPILER_VC | GLM_COMPILER_INTEL)) return _isnan(x) != 0; # elif(GLM_COMPILER & (GLM_COMPILER_GCC | GLM_COMPILER_CLANG)) # if(GLM_PLATFORM & GLM_PLATFORM_ANDROID && __cplusplus < 201103L) @@ -780,11 +782,11 @@ namespace detail GLM_FUNC_QUALIFIER bool isinf( genType const & x) { - GLM_STATIC_ASSERT( - std::numeric_limits::is_iec559, - "'isinf' only accept floating-point inputs"); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'isinf' only accept floating-point inputs"); -# if(GLM_COMPILER & (GLM_COMPILER_INTEL | GLM_COMPILER_VC)) +# if(GLM_LANG & GLM_LANG_CXX11_FLAG) + return std::isinf(x); +# elif(GLM_COMPILER & (GLM_COMPILER_INTEL | GLM_COMPILER_VC)) return _fpclass(x) == _FPCLASS_NINF || _fpclass(x) == _FPCLASS_PINF; # elif(GLM_COMPILER & (GLM_COMPILER_GCC | GLM_COMPILER_CLANG)) # if(GLM_PLATFORM & GLM_PLATFORM_ANDROID && __cplusplus < 201103L) diff --git a/readme.txt b/readme.txt index f1214670..d9005474 100644 --- a/readme.txt +++ b/readme.txt @@ -43,6 +43,7 @@ GLM 0.9.5.5: 2014-XX-XX - Fixed missing value_type for dual quaternion - Fixed return type of dual quaternion length - Fixed infinite loop in isfinite function with GCC #221 +- Rely on C++11 to implement isinf and isnan ================================================================================ GLM 0.9.5.4: 2014-06-21