+/*
+ * Hash function with nr_hash_chains != 0 for testing purpose only!
+ * Creates very long hash chains, deteriorating the hash table into a
+ * few linked lists, depending on the nr_hash_chains value. The purpose
+ * of this test is to check how the hash table behaves with hash chains
+ * containing different values, which is a rare case in a normal hash
+ * table.
+ */
+static inline
+unsigned long test_hash(const void *_key, size_t length,
+ unsigned long seed)
+{
+ if (nr_hash_chains == 0) {
+ return test_hash_mix(_key, length, seed);
+ } else {
+ unsigned long v;
+
+ assert(length == sizeof(unsigned long));
+ v = (unsigned long) _key;
+ return v % nr_hash_chains;
+ }
+}
+