Mercurial > hg > octave-kai > gnulib-hg
changeset 1360:89ddc5685941
(is_prime): Ansideclify.
(next_prime): Ansideclify. Add an assertion.
author | Jim Meyering <jim@meyering.net> |
---|---|
date | Sat, 16 May 1998 04:39:24 +0000 |
parents | 4fd0cf3d4911 |
children | 736d4f1fbeb4 |
files | lib/hash.c |
diffstat | 1 files changed, 5 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/lib/hash.c +++ b/lib/hash.c @@ -376,9 +376,8 @@ /* Return true if CANDIDATE is a prime number. CANDIDATE should be an odd number at least equal to 11. */ -static bool -is_prime (candidate) - unsigned long candidate; +static int +is_prime (unsigned long candidate) { unsigned long divisor = 3; unsigned long square = divisor * divisor; @@ -397,9 +396,10 @@ prime. CANDIDATE should be at least equal to 10. */ static unsigned long -next_prime (candidate) - unsigned long candidate; +next_prime (unsigned long candidate) { + assert (candidate >= 10); + /* Make it definitely odd. */ candidate |= 1;