pike.git / src / stuff.c

version» Context lines:

pike.git/src/stuff.c:1:   /*   || This file is part of Pike. For copyright information see COPYRIGHT.   || Pike is distributed under GPL, LGPL and MPL. See the file COPYING   || for more information. - || $Id: stuff.c,v 1.21 2002/10/11 01:39:38 nilsson Exp $ + || $Id: stuff.c,v 1.22 2004/05/31 23:51:27 nilsson Exp $   */      #include "global.h"   #include "stuff.h"   #include "stralloc.h"      /* Not all of these are primes, but they should be adequate */ - PMOD_EXPORT INT32 hashprimes[32] = + PMOD_EXPORT const 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:    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)   { -  static signed char bit[256] = +  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,    7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
pike.git/src/stuff.c:92:   }         /* 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,\    X+2,X+3,X+3,X+4 -  static char bits[256] = +  static const 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] +