updat code

This commit is contained in:
Nick Peng
2018-04-24 00:24:44 +08:00
parent c6af293927
commit d3960e1018
14 changed files with 744 additions and 175 deletions

View File

@@ -1,6 +1,7 @@
#ifndef _GENERIC_HASH_H
#define _GENERIC_HASH_H
#include "bitmap.h"
#include "jhash.h"
/* Fast hashing routine for ints, longs and pointers.
@@ -113,6 +114,17 @@ int __ilog2_u64(uint64_t n)
__ilog2_u64(n) \
)
#if BITS_PER_LONG == 32
#define GOLDEN_RATIO_PRIME GOLDEN_RATIO_32
#define hash_long(val, bits) hash_32(val, bits)
#elif BITS_PER_LONG == 64
#define hash_long(val, bits) hash_64(val, bits)
#define GOLDEN_RATIO_PRIME GOLDEN_RATIO_64
#else
#error Wordsize not 32 or 64
#endif
/*
* This hash multiplies the input by a large odd number and takes the
* high bits. Since multiplication propagates changes to the most