summaryrefslogtreecommitdiff
path: root/lib/hash.c
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>1998-05-16 04:39:24 +0000
committerJim Meyering <jim@meyering.net>1998-05-16 04:39:24 +0000
commit4f75855c2eec3258c7dd7d109bd4f47e612931db (patch)
treeb2bcfae3b41aa64de00ca0bc38c505adb29f450b /lib/hash.c
parentd6499106855208c2ae2f72ddba23079910d0ca9a (diff)
downloadcoreutils-4f75855c2eec3258c7dd7d109bd4f47e612931db.tar.xz
(is_prime): Ansideclify.
(next_prime): Ansideclify. Add an assertion.
Diffstat (limited to 'lib/hash.c')
-rw-r--r--lib/hash.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/hash.c b/lib/hash.c
index 5c61b54df..5899f57c3 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;