diff --git a/glm/core/func_integer.inl b/glm/core/func_integer.inl index 07a748ba..62d5b920 100644 --- a/glm/core/func_integer.inl +++ b/glm/core/func_integer.inl @@ -544,10 +544,13 @@ namespace glm ) { /** - * ctz returns the number or trailing 0-bits; see + * clz returns the number or trailing 0-bits; see * http://gcc.gnu.org/onlinedocs/gcc-4.7.1/gcc/Other-Builtins.html + * + * NoteBecause __builtin_clz only works for unsigned ints, this + * implementation will not work for 64-bit integers. */ - return __builtin_ctz(Value); + return 31 - __builtin_clz(Value); } #else