From: Jim Meyering Date: Sat, 16 May 1998 04:39:24 +0000 (+0000) Subject: (is_prime): Ansideclify. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bc44d4026e607c8acd24f5652d8bcc521560b03e;p=pspp (is_prime): Ansideclify. (next_prime): Ansideclify. Add an assertion. --- diff --git a/lib/hash.c b/lib/hash.c index 5c61b54df3..5899f57c3d 100644 --- a/lib/hash.c +++ b/lib/hash.c @@ -376,9 +376,8 @@ hash_string (const char *string, unsigned int n_buckets) /* 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 @@ is_prime (candidate) 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;