primes: faster output

R=rsc
http://codereview.appspot.com/4664053
This commit is contained in:
Russ Cox 2011-06-28 18:58:44 -04:00
parent 5e83be0dbf
commit 29fba8562c

View file

@ -1,5 +1,6 @@
#include <u.h>
#include <libc.h>
#include <bio.h>
#define ptsiz (sizeof(pt)/sizeof(pt[0]))
#define whsiz (sizeof(wheel)/sizeof(wheel[0]))
@ -32,6 +33,7 @@ uchar bittab[] =
void mark(double nn, long k);
void ouch(void);
Biobuf bout;
void
main(int argc, char *argp[])
@ -39,6 +41,8 @@ main(int argc, char *argp[])
int i;
double k, temp, v, limit, nn;
Binit(&bout, 1, OWRITE);
if(argc <= 1) {
fprint(2, "usage: primes starting [ending]\n");
exits("usage");
@ -101,7 +105,7 @@ main(int argc, char *argp[])
temp = nn + i;
if(temp > limit)
exits(0);
print("%.0f\n", temp);
Bprint(&bout, "%lld\n", (long long)temp);
if(limit >= big)
exits(0);
}