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.23 2004/11/14 18:03:50 mast Exp $ + || $Id$   */      #include "global.h"   #include "stuff.h"   #include "stralloc.h"      /* Used by is8bitalnum in pike_macros.h. */   PMOD_EXPORT const char Pike_is8bitalnum_vector[] =    "0000000000000000"    "0000000000000000"
pike.git/src/stuff.c:423:    /* For really large numbers, produce a number which is not    * a prime, but hopefully good for hash tables, although I    * seriously doubt anybody will use hashtables larger than    * 1<<32 entries... /Hubbe    */    y = (y<<5)|(x&31);    if(y >= NELEM(primes)) return num|7;       return primes[y];   } +  + /* +  * This rounds an integer up to the next power of two. For x a power +  * of two, this will just return the same again. +  */ + unsigned INT32 find_next_power(unsigned INT32 x) + { +  x--; +  x |= x >> 1; +  x |= x >> 2; +  x |= x >> 4; +  x |= x >> 8; +  x |= x >> 16; +  x++; +  return x; + }