Fix integer version of glm::log2 for GCC

This pretty much reverts the fix done in commit
1ed0e3865b

This temporarily breaks log2 for GCC in cases where GLM_FORCE_PURE
is not defined. The workaround introduced in commit
1ed0e3865b seems to rely
on getting invalid results from the nlz function.

Broken nlz is caused by a broken findMSB function for GCC.

A fix for the findMSB function should be available in a nearby
separate commit.
This commit is contained in:
Joonas Sarajärvi 2012-09-12 01:30:12 +03:00
parent 72a01d3432
commit da530ac46e

View File

@ -60,10 +60,8 @@ namespace _detail
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER T operator() (T const & Value) const GLM_FUNC_QUALIFIER T operator() (T const & Value) const
{ {
#if(GLM_COMPILER & GLM_COMPILER_VC) #if(GLM_COMPILER & (GLM_COMPILER_VC | GLM_COMPILER_GCC))
return Value <= T(1) ? T(0) : T(32) - nlz(Value - T(1)); return Value <= T(1) ? T(0) : T(32) - nlz(Value - T(1));
#elif(GLM_COMPILER & GLM_COMPILER_GCC)
return Value <= T(1) ? T(0) : nlz(Value - T(1)) + 1;
#else #else
return T(32) - nlz(Value - T(1)); return T(32) - nlz(Value - T(1));
#endif #endif