From 8c4ea6ebb26c55f21e04389741453bda05d372e0 Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Thu, 20 Sep 2012 12:28:12 +0200 Subject: [PATCH] Fixed isnan on GCC --- glm/core/func_common.hpp | 2 ++ glm/core/func_common.inl | 13 +++++++++++++ 2 files changed, 15 insertions(+) diff --git a/glm/core/func_common.hpp b/glm/core/func_common.hpp index 3c268190..9caa3e75 100644 --- a/glm/core/func_common.hpp +++ b/glm/core/func_common.hpp @@ -303,6 +303,8 @@ namespace glm /// floating point representations. Returns false otherwise, /// including for implementations with no NaN /// representations. + /// + /// /!\ When using compiler fast math, this function may fail. /// /// @tparam genType Floating-point scalar or vector types. /// diff --git a/glm/core/func_common.inl b/glm/core/func_common.inl index b3b3839f..5b59cd50 100644 --- a/glm/core/func_common.inl +++ b/glm/core/func_common.inl @@ -864,6 +864,18 @@ namespace detail { GLM_STATIC_ASSERT(detail::type::is_float, "'isinf' only accept floating-point inputs"); +# if(GLM_COMPILER & (GLM_COMPILER_INTEL | GLM_COMPILER_VC)) + return _fpclass(x) == _FPCLASS_NINF || _fpclass(x) == _FPCLASS_PINF; +# elif(GLM_COMPILER & GLM_COMPILER_GCC) +# if(GLM_PLATFORM & GLM_PLATFORM_ANDROID) + return _isinf(x) != 0; +# else + return std::isinf(x); +# endif +# else + return std::isinf(x); +# endif +/* # if(GLM_COMPILER & GLM_COMPILER_VC) return _fpclass(x) == _FPCLASS_NINF || _fpclass(x) == _FPCLASS_PINF; # elif(GLM_COMPILER & GLM_COMPILER_GCC) @@ -877,6 +889,7 @@ namespace detail # else return std::isinf(x); # endif +*/ } template