diff options
author | Michael I. Bushnell <mib@gnu.org> | 1994-04-07 22:29:18 +0000 |
---|---|---|
committer | Michael I. Bushnell <mib@gnu.org> | 1994-04-07 22:29:18 +0000 |
commit | 1f814fb2cce4171c3fdaa5f3a73ea58af10d6e39 (patch) | |
tree | 47357dabb6f5be90011287b89f2d3748f0b0fb0a | |
parent | 6ba28409cc03bc8d368a80beda33902ca32b0471 (diff) |
Formerly primes.c.~7~
-rw-r--r-- | proc/primes.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/proc/primes.c b/proc/primes.c index 65f4e5b8..24253e63 100644 --- a/proc/primes.c +++ b/proc/primes.c @@ -18,7 +18,7 @@ #include <stdlib.h> #include <string.h> -/* Return the next prime greater than or equal to n. */ +/* Return the next prime greater than or equal to N. */ int nextprime (int n) { @@ -29,6 +29,8 @@ nextprime (int n) int *m; int i, j; + /* You are not expected to understand this. */ + if (!q) { /* Init */ @@ -42,8 +44,9 @@ nextprime (int n) while (n > q[l - 1]) { - /* Grow q */ + /* Grow */ + /* Alloc */ p = q[l-1] * q[l-1]; m = alloca (sizeof (int) * p); bzero (m, sizeof (int) * p); @@ -66,7 +69,7 @@ nextprime (int n) } } - /* Binary search */ + /* Search */ i = 0; j = l - 1; p = j / 2; |