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