Browse Source

Merge branch '0.9.5' of https://github.com/g-truc/glm into 0.9.5

Christophe Riccio 11 years ago
parent
commit
a614e5da63
3 changed files with 12 additions and 6 deletions
  1. 7 5
      glm/detail/func_common.inl
  2. 3 1
      glm/gtx/compatibility.inl
  3. 2 0
      readme.txt

+ 7 - 5
glm/detail/func_common.inl

@@ -713,7 +713,9 @@ namespace detail
 			std::numeric_limits<genType>::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<genType>::is_iec559,
-			"'isinf' only accept floating-point inputs");
+		GLM_STATIC_ASSERT(std::numeric_limits<genType>::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)

+ 3 - 1
glm/gtx/compatibility.inl

@@ -7,6 +7,8 @@
 // File    : glm/gtx/compatibility.inl
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
+#include <limits>
+
 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<genType>::min() && x <= std::numeric_limits<genType>::max();
 #		endif
 	}
 

+ 2 - 0
readme.txt

@@ -53,6 +53,8 @@ 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
+- Rely on C++11 to implement isinf and isnan
 
 ================================================================================
 GLM 0.9.5.4: 2014-06-21