projects
/
u
/
mdw
/
catacomb
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Tidying.
[u/mdw/catacomb]
/
genprimes.c
diff --git
a/genprimes.c
b/genprimes.c
index
c05826a
..
2961621
100644
(file)
--- a/
genprimes.c
+++ b/
genprimes.c
@@
-1,6
+1,6
@@
/* -*-c-*-
*
/* -*-c-*-
*
- * $Id: genprimes.c,v 1.
2 1999/12/22 15:48:39
mdw Exp $
+ * $Id: genprimes.c,v 1.
4 2001/03/04 13:08:10
mdw Exp $
*
* Generate prime number table
*
*
* Generate prime number table
*
@@
-30,6
+30,12
@@
/*----- Revision history --------------------------------------------------*
*
* $Log: genprimes.c,v $
/*----- Revision history --------------------------------------------------*
*
* $Log: genprimes.c,v $
+ * Revision 1.4 2001/03/04 13:08:10 mdw
+ * Use @DA_LAST@ to determine @MAXPRIME@, now that it exists.
+ *
+ * Revision 1.3 2000/08/15 21:41:58 mdw
+ * Create a new type for the small primes table elements.
+ *
* Revision 1.2 1999/12/22 15:48:39 mdw
* Rename output file. Make output constants unsigned.
*
* Revision 1.2 1999/12/22 15:48:39 mdw
* Rename output file. Make output constants unsigned.
*
@@
-104,7
+110,7
@@
int main(int argc, char *argv[])
if (!p_max && !p_n)
die(EXIT_FAILURE, "bad arguments to `-n' or `-m'");
if (!p_max && !p_n)
die(EXIT_FAILURE, "bad arguments to `-n' or `-m'");
- if (p_max >= 2)
+ if (p_
n || p_
max >= 2)
DA_PUSH(&p, 2);
for (i = 3; (!p_max && !p_n) ||
(p_n && DA_LEN(&p) < p_n) ||
DA_PUSH(&p, 2);
for (i = 3; (!p_max && !p_n) ||
(p_n && DA_LEN(&p) < p_n) ||
@@
-146,13
+152,14
@@
int main(int argc, char *argv[])
#define NPRIME %luu\n\
#define MAXPRIME %uu\n\
\n\
#define NPRIME %luu\n\
#define MAXPRIME %uu\n\
\n\
-extern %s %s[];\n\
+typedef %s smallprime;\n\
+extern smallprime %s[];\n\
\n\
#endif\n\
",
d.buf, d.buf,
(unsigned long)DA_LEN(&p),
\n\
#endif\n\
",
d.buf, d.buf,
(unsigned long)DA_LEN(&p),
- DA
(&p)[DA_LEN(&p) - 1]
,
+ DA
_LAST(&p)
,
type, name);
dstr_destroy(&d);
if (fclose(fp) == EOF) {
type, name);
dstr_destroy(&d);
if (fclose(fp) == EOF) {