summaryrefslogtreecommitdiff
path: root/libihash/sizes.c
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>2001-08-15 09:29:26 +0000
committerRoland McGrath <roland@gnu.org>2001-08-15 09:29:26 +0000
commit175fa7701ded3785c31e82581f74e2fd32db7330 (patch)
tree3f803cb1d0a82472400823a51d74ff5107dcdc72 /libihash/sizes.c
parent0642002d933b3b135f9af076f862ad1504c59d4a (diff)
2001-08-15 Roland McGrath <roland@frob.com>
* sizes.c: New file, a list of prime numbers useful for table sizes. * priv.h (_ihash_sizes, _ihash_nsizes): Declare. (_ihash_nextprime): Don't. * ihash.c (ihash_add): Select sizes from the _ihash_sizes array instead of using _ihash_nextprime. * Makefile: Clean up whitespace, reorder all the variable definitions. (SRCS): Remove primes.c, add sizes.c instead. (OBJS): Define dynamically.
Diffstat (limited to 'libihash/sizes.c')
-rw-r--r--libihash/sizes.c41
1 files changed, 41 insertions, 0 deletions
diff --git a/libihash/sizes.c b/libihash/sizes.c
new file mode 100644
index 00000000..17f3fb1f
--- /dev/null
+++ b/libihash/sizes.c
@@ -0,0 +1,41 @@
+/* Some prime numbers for the ihash library.
+ I cannot bring myself to assert copyright over a list of prime numbers.
+ This file is in the public domain. */
+
+#include "priv.h"
+
+/* The prime numbers greater than twice the last and less than 2^32. */
+const unsigned int _ihash_sizes[] =
+{
+ 2,
+ 5,
+ 11,
+ 23,
+ 47,
+ 97,
+ 197,
+ 397,
+ 797,
+ 1597,
+ 3203,
+ 6421,
+ 12853,
+ 25717,
+ 51437,
+ 102877,
+ 205759,
+ 411527,
+ 823117,
+ 1646237,
+ 3292489,
+ 6584983,
+ 13169977,
+ 26339969,
+ 52679969,
+ 105359939,
+ 210719881,
+ 421439783,
+};
+
+const unsigned int _ihash_nsizes = (sizeof _ihash_sizes
+ / sizeof _ihash_sizes[0]);