X-Git-Url: https://git.kernel.dk/?p=fio.git;a=blobdiff_plain;f=hash.h;h=51f0706e2cc5cc5a310efaf43b86b3417ef8d198;hp=f7596a56367572b2852d049144103979ead08eea;hb=9dc528b1638b625b5e167983a74de4e85c5859ea;hpb=87933e32e356b15b85c6d9775d5e840994080a4f diff --git a/hash.h b/hash.h index f7596a56..51f0706e 100644 --- a/hash.h +++ b/hash.h @@ -9,32 +9,6 @@ (C) 2002 William Lee Irwin III, IBM */ /* - * Knuth recommends primes in approximately golden ratio to the maximum - * integer representable by a machine word for multiplicative hashing. - * Chuck Lever verified the effectiveness of this technique: - * http://www.citi.umich.edu/techreports/reports/citi-tr-00-1.pdf - * - * These primes are chosen to be bit-sparse, that is operations on - * them can use shifts and additions instead of multiplications for - * machines where multiplications are slow. - */ - -#if BITS_PER_LONG == 32 -/* 2^31 + 2^29 - 2^25 + 2^22 - 2^19 - 2^16 + 1 */ -#define GOLDEN_RATIO_PRIME 0x9e370001UL -#elif BITS_PER_LONG == 64 -/* 2^63 + 2^61 - 2^57 + 2^54 - 2^51 - 2^18 + 1 */ -#define GOLDEN_RATIO_PRIME 0x9e37fffffffc0001UL -#else -#error Define GOLDEN_RATIO_PRIME for your wordsize. -#endif - -/* - * The above primes are actively bad for hashing, since they are - * too sparse. The 32-bit one is mostly ok, the 64-bit one causes - * real problems. Besides, the "prime" part is pointless for the - * multiplicative hash. - * * Although a random odd number will do, it turns out that the golden * ratio phi = (sqrt(5)-1)/2, or its negative, has particularly nice * properties.