Fixed isnan for Intel compiler

This commit is contained in:
Christophe Riccio 2012-09-20 10:17:03 +02:00
parent b1ecabdd28
commit b012c80771
3 changed files with 14 additions and 4 deletions

View File

@ -40,6 +40,8 @@ elseif(NOT GLM_TEST_ENABLE_MS_EXTENSIONS)
endif() endif()
endif() endif()
#set(GLM_SIMD_INSTRUCTION_SET "" CACHE STRING "Instruction set. Possible values are SSE1, SSE2")
option(GLM_TEST_ENABLE_SIMD "Enable SIMD optimizations" OFF) option(GLM_TEST_ENABLE_SIMD "Enable SIMD optimizations" OFF)
if(GLM_TEST_ENABLE_SIMD) if(GLM_TEST_ENABLE_SIMD)
if(CMAKE_COMPILER_IS_GNUCXX) if(CMAKE_COMPILER_IS_GNUCXX)

View File

@ -809,7 +809,7 @@ namespace detail
{ {
GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'isnan' only accept floating-point inputs"); GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'isnan' only accept floating-point inputs");
# if(GLM_COMPILER & GLM_COMPILER_VC) # if(GLM_COMPILER & (GLM_COMPILER_VC | GLM_COMPILER_INTEL))
return _isnan(x) != 0; return _isnan(x) != 0;
# elif(GLM_COMPILER & GLM_COMPILER_GCC) # elif(GLM_COMPILER & GLM_COMPILER_GCC)
# if(GLM_PLATFORM & GLM_PLATFORM_ANDROID) # if(GLM_PLATFORM & GLM_PLATFORM_ANDROID)
@ -817,8 +817,16 @@ namespace detail
# else # else
return std::isnan(x); return std::isnan(x);
# endif # endif
/*
# elif(GLM_COMPILER & GLM_COMPILER_GCC)
# if(GLM_PLATFORM & GLM_PLATFORM_ANDROID)
return _isnan(x) != 0;
# else
return std::isnan(x);
# endif
# elif(GLM_COMPILER & GLM_COMPILER_INTEL) # elif(GLM_COMPILER & GLM_COMPILER_INTEL)
return isnan(x) != 0; return _isnan(x) != 0;
*/
# else # else
return std::isnan(x); return std::isnan(x);
# endif # endif

View File

@ -364,14 +364,14 @@ int test_isnan()
Error += true == glm::any(glm::isnan(glm::dvec3(0.0 / Zero_d))) ? 0 : 1; Error += true == glm::any(glm::isnan(glm::dvec3(0.0 / Zero_d))) ? 0 : 1;
Error += true == glm::any(glm::isnan(glm::dvec4(0.0 / Zero_d))) ? 0 : 1; Error += true == glm::any(glm::isnan(glm::dvec4(0.0 / Zero_d))) ? 0 : 1;
} }
/*
{ {
Error += true == glm::isnan(0.0f/Zero_f) ? 0 : 1; Error += true == glm::isnan(0.0f/Zero_f) ? 0 : 1;
Error += true == glm::any(glm::isnan(glm::vec2(0.0f/Zero_f))) ? 0 : 1; Error += true == glm::any(glm::isnan(glm::vec2(0.0f/Zero_f))) ? 0 : 1;
Error += true == glm::any(glm::isnan(glm::vec3(0.0f/Zero_f))) ? 0 : 1; Error += true == glm::any(glm::isnan(glm::vec3(0.0f/Zero_f))) ? 0 : 1;
Error += true == glm::any(glm::isnan(glm::vec4(0.0f/Zero_f))) ? 0 : 1; Error += true == glm::any(glm::isnan(glm::vec4(0.0f/Zero_f))) ? 0 : 1;
} }
*/
return Error; return Error;
} }