pike.git / src / stuff.c

version» Context lines:

pike.git/src/stuff.c:63:    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(__i386__) && defined(__GNUC__) +  long ret = -2; + #if SIZEOF_CHAR_P > 4 +  asm("bsrq %1, %0" :"+r"(ret) :"rm"(x)); + #else +  asm("bsrl %1, %0" :"+r"(ret) :"rm"(x)); + #endif +  return ret+1; + #else    static const signed char bit[256] =    {    -1, 0, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3,    4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,    5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,    5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,    6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,    6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,    6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,    6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
pike.git/src/stuff.c:101: Inside #if SIZEOF_CHAR_P > 4
   return bit[tmp]+32;    }   #endif /* SIZEOF_CHAP_P > 4 */    if((tmp=(x>>16)))    {    if((x=(tmp>>8))) return bit[x]+24;    return bit[tmp]+16;    }    if((tmp=(x>>8))) return bit[tmp]+8;    return bit[x]; + #endif   }         #if 0   /* Return the number of bits in a 32-bit integer */   PMOD_EXPORT int count_bits(unsigned INT32 x)   {   #define B(X) X+0,X+1,X+1,X+2,\    X+1,X+2,X+2,X+3,\    X+1,X+2,X+2,X+3,\