nloop cleanup courtesy Serge Belyshev.

This commit is contained in:
Con Kolivas 2011-03-22 21:34:04 +11:00
parent a901b015bf
commit bdf19e2654

14
main.c
View file

@ -459,15 +459,17 @@ out:
static i64 nloops(i64 seconds, uchar *b1, uchar *b2)
{
i64 nloops_encoded, nloops;
i64 nloops;
int nbits;
nloops = ARBITRARY_AT_EPOCH * pow(MOORE_TIMES_PER_SECOND, seconds);
nbits = log (nloops) / M_LN2;
*b1 = nbits - 7;
*b2 = nloops >> *b1;
nloops_encoded = (i64)*b2 << (i64)*b1;
return nloops_encoded;
if (nloops < ARBITRARY)
nloops = ARBITRARY;
for (nbits = 0; nloops > 255; nbits ++)
nloops = nloops >> 1;
*b1 = nbits;
*b2 = nloops;
return nloops << nbits;
}
int main(int argc, char *argv[])