Fixed use of intrinsics in pure mode #92

This commit is contained in:
Christophe Riccio 2013-06-13 16:37:00 +00:00
parent 5b7154468c
commit 9f1e0cd388

View File

@ -26,10 +26,12 @@
/// @author Christophe Riccio /// @author Christophe Riccio
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
#if(GLM_ARCH != GLM_ARCH_PURE)
#if(GLM_COMPILER & GLM_COMPILER_VC) #if(GLM_COMPILER & GLM_COMPILER_VC)
#include <intrin.h> # include <intrin.h>
#pragma intrinsic(_BitScanReverse) # pragma intrinsic(_BitScanReverse)
#endif #endif//(GLM_COMPILER & GLM_COMPILER_VC)
#endif//(GLM_ARCH != GLM_ARCH_PURE)
namespace glm namespace glm
{ {
@ -521,7 +523,6 @@ namespace glm
} }
// findMSB // findMSB
/*
#if((GLM_ARCH != GLM_ARCH_PURE) && (GLM_COMPILER & GLM_COMPILER_VC)) #if((GLM_ARCH != GLM_ARCH_PURE) && (GLM_COMPILER & GLM_COMPILER_VC))
template <typename genIUType> template <typename genIUType>
@ -538,7 +539,7 @@ namespace glm
_BitScanReverse(&Result, Value); _BitScanReverse(&Result, Value);
return int(Result); return int(Result);
} }
/*
// __builtin_clz seems to be buggy as it crasks for some values, from 0x00200000 to 80000000 // __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)) #elif((GLM_ARCH != GLM_ARCH_PURE) && (GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC40))
@ -560,8 +561,9 @@ namespace glm
// //
return 31 - __builtin_clzl(Value); return 31 - __builtin_clzl(Value);
} }
#else
*/ */
#else
/* SSE implementation idea /* SSE implementation idea
__m128i const Zero = _mm_set_epi32( 0, 0, 0, 0); __m128i const Zero = _mm_set_epi32( 0, 0, 0, 0);
@ -606,7 +608,7 @@ namespace glm
return MostSignificantBit; return MostSignificantBit;
} }
} }
//#endif//(GLM_COMPILER) #endif//(GLM_COMPILER)
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER detail::tvec2<int, P> findMSB GLM_FUNC_QUALIFIER detail::tvec2<int, P> findMSB