From da530ac46ed55f897475fe15d4bf76615afb8db1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joonas=20Saraj=C3=A4rvi?= Date: Wed, 12 Sep 2012 01:30:12 +0300 Subject: [PATCH] Fix integer version of glm::log2 for GCC This pretty much reverts the fix done in commit 1ed0e3865b5de0ee993b064b37749bc85e928d7f This temporarily breaks log2 for GCC in cases where GLM_FORCE_PURE is not defined. The workaround introduced in commit 1ed0e3865b5de0ee993b064b37749bc85e928d7f 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. --- glm/gtx/integer.inl | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/glm/gtx/integer.inl b/glm/gtx/integer.inl index 2f2535b4..14e6afa9 100644 --- a/glm/gtx/integer.inl +++ b/glm/gtx/integer.inl @@ -60,10 +60,8 @@ namespace _detail template 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)); -#elif(GLM_COMPILER & GLM_COMPILER_GCC) - return Value <= T(1) ? T(0) : nlz(Value - T(1)) + 1; #else return T(32) - nlz(Value - T(1)); #endif