pike.git / src / stuff.c

version» Context lines:

pike.git/src/stuff.c:57:    16777215, /* ~ 2^24 = 16777216 */    33554431, /* ~ 2^25 = 33554432 */    67108863, /* ~ 2^26 = 67108864 */    134217727, /* ~ 2^27 = 134217728 */    268435455, /* ~ 2^28 = 268435456 */    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) */ + /* Same thing as (int)floor(log((double)x) / log(2.0)), except a bit +  quicker. Number of log2 per second:    -  +  log(x)/log(2.0) 50,000,000 +  log2(x) 75,000,000 +  Table lookup 3,000,000,000 +  Intrinsic 30,000,000,000,000,000 + */ +    PMOD_EXPORT int my_log2(size_t x)   {    if( x == 0 ) return 0;    return log2_u32(x);   }         PMOD_EXPORT double my_strtod(char *nptr, char **endptr)   {    double tmp=strtod(nptr,endptr);