pike.git / src / stuff.c

version» Context lines:

pike.git/src/stuff.c:61:    536870911, /* ~ 2^29 = 536870912 */    1073741823,/* ~ 2^30 = 1073741824 */    2147483647,/* ~ 2^31 = 2147483648 */   };      /* same thing as (int)floor(log((double)x) / log(2.0)) */   /* Except a bit quicker :) (hopefully) */      PMOD_EXPORT int my_log2(size_t x)   { - #if (defined(__x86_64) || defined(__i386__)) && defined(__GNUC__) + #if defined(HAS___BUILTIN_CLZL)    if( x == 0 ) return 0; - #if SIZEOF_CHAR_P > 4 -  asm("bsrq %1, %0" :"+r"(x) :"rm"(x)); - #else -  asm("bsrl %1, %0" :"+r"(x) :"rm"(x)); - #endif /* sizeof(char*) */ -  return x+1; - #elif defined(HAS___BUILTIN_CLZL) -  if( x == 0 ) return 0; +     return ((sizeof(unsigned long)*8)-__builtin_clzl(x))-1;   #elif defined(HAS___BUILTIN_CLZ)    /* on arm32 only this one exists. Happily enough sizeof(int) is    * sizeof(size_t).    */    if( x == 0 ) return 0;    return ((sizeof(int)*8)-__builtin_clz(x))-1;   #else    static const signed char bit[256] =    {