I wonder why this result isn’t on google’s #1 for int log2 gcc.

To get the integer logarithm to the base of 2, try

      sizeof(int) * __CHAR_BIT__ - 1 - __builtin_clz(   n );
     sizeof(long) * __CHAR_BIT__ - 1 - __builtin_clzl(  n );
sizeof(long long) * __CHAR_BIT__ - 1 - __builtin_clzll( n );