pike.git / src / stuff.c

version» Context lines:

pike.git/src/stuff.c:134:   {    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; - } -  +    /*    * 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)   {    if( x == 0 ) return 1;    return 1<<(my_log2(x-1)+1);   }