pike.git / src / stuff.c

version» Context lines:

pike.git/src/stuff.c:1:   /*\   ||| This file a part of Pike, and is copyright by Fredrik Hubinette   ||| Pike is distributed as GPL (General Public License)   ||| See the files COPYING and DISCLAIMER for more information.   \*/      /* -  * $Id: stuff.c,v 1.10 1999/03/24 16:31:38 grubba Exp $ +  * $Id: stuff.c,v 1.11 2000/07/28 17:16:55 hubbe Exp $    */   #include "global.h"   #include "stuff.h"   #include "stralloc.h"      /* Not all of these are primes, but they should be adequate */ - INT32 hashprimes[32] = + PMOD_EXPORT INT32 hashprimes[32] =   {    31, /* ~ 2^0 = 1 */    31, /* ~ 2^1 = 2 */    31, /* ~ 2^2 = 4 */    31, /* ~ 2^3 = 8 */    31, /* ~ 2^4 = 16 */    31, /* ~ 2^5 = 32 */    61, /* ~ 2^6 = 64 */    127, /* ~ 2^7 = 128 */    251, /* ~ 2^8 = 256 */
pike.git/src/stuff.c:44:    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) */    - int my_log2(unsigned INT32 x) + PMOD_EXPORT int my_log2(unsigned INT32 x)   {    static 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,
pike.git/src/stuff.c:77:    {    if((x=(tmp>>8))) return bit[x]+24;    return bit[tmp]+16;    }    if((tmp=(x>>8))) return bit[tmp]+8;    return bit[x];   }         /* Return the number of bits in a 32-bit integer */ - int count_bits(unsigned INT32 x) + 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,\    X+2,X+3,X+3,X+4    static char bits[256] =    {    B(0), B(1), B(1), B(2),    B(1), B(2), B(2), B(3),    B(1), B(2), B(2), B(3),    B(2), B(3), B(3), B(4)    };       return (bits[x & 255] +    bits[(x>>8) & 255] +    bits[(x>>16) & 255] +    bits[(x>>24) & 255]);   }      /* Return true for integers with more than one bit set */ - int is_more_than_one_bit(unsigned INT32 x) + PMOD_EXPORT int is_more_than_one_bit(unsigned INT32 x)   {    return !!(x & (x-1));   }    - double my_strtod(char *nptr, char **endptr) + PMOD_EXPORT double my_strtod(char *nptr, char **endptr)   {    double tmp=STRTOD(nptr,endptr);    if(*endptr>nptr)    {    if(endptr[0][-1]=='.')    endptr[0]--;    }    return tmp;   }