Index: src/misc/hashtable.hpp =================================================================== --- src/misc/hashtable.hpp (revision 27993) +++ src/misc/hashtable.hpp (working copy) @@ -12,8 +12,6 @@ #ifndef HASHTABLE_HPP #define HASHTABLE_HPP -#include "../core/math_func.hpp" - template struct CHashTableSlotT { @@ -161,12 +159,10 @@ /** static helper - return hash for the given key modulo number of slots */ inline static int CalcHash(const Tkey &key) { - int32 hash = key.CalcHash(); - if ((8 * Thash_bits) < 32) hash ^= hash >> (min(8 * Thash_bits, 31)); - if ((4 * Thash_bits) < 32) hash ^= hash >> (min(4 * Thash_bits, 31)); - if ((2 * Thash_bits) < 32) hash ^= hash >> (min(2 * Thash_bits, 31)); - if ((1 * Thash_bits) < 32) hash ^= hash >> (min(1 * Thash_bits, 31)); - hash &= (1 << Thash_bits) - 1; + uint32 hash = key.CalcHash(); + hash -= (hash >> 17); // hash * 131071 / 131072 + hash -= (hash >> 5); // * 31 / 32 + hash &= (1 << Thash_bits) - 1; // modulo slots return hash; }