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.12 2000/08/10 09:20:00 grubba Exp $ +  * $Id: stuff.c,v 1.13 2000/09/20 02:04:26 hubbe 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] =   {    31, /* ~ 2^0 = 1 */    31, /* ~ 2^1 = 2 */
pike.git/src/stuff.c:125:   {    double tmp=STRTOD(nptr,endptr);    if(*endptr>nptr)    {    if(endptr[0][-1]=='.')    endptr[0]--;    }    return tmp;   }    + PMOD_EXPORT unsigned INT32 my_sqrt(unsigned INT32 n) + { +  unsigned INT32 b, s, y=0; +  unsigned INT16 x=0; +  +  for(b=1<<(sizeof(INT32)*8-2); b; b>>=2) +  { +  x<<=1; s=b+y; y>>=1; +  if(n>=s) +  { +  x|=1; y|=b; n-=s; +  } +  } +  return x; + }