From 1f814fb2cce4171c3fdaa5f3a73ea58af10d6e39 Mon Sep 17 00:00:00 2001 From: "Michael I. Bushnell" Date: Thu, 7 Apr 1994 22:29:18 +0000 Subject: Formerly primes.c.~7~ --- proc/primes.c | 9 ++++++--- 1 file 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 #include -/* 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; -- cgit v1.2.3