Fix hasher usage and narrow interface.

This commit is contained in:
Matthias Vallentin 2013-06-06 13:39:00 -07:00
parent 7ce986e31f
commit fcf1807fc8
2 changed files with 3 additions and 11 deletions

View file

@ -93,8 +93,8 @@ HashPolicy::HashVector DefaultHashing::Hash(const void* x, size_t n) const
HashPolicy::HashVector DoubleHashing::Hash(const void* x, size_t n) const HashPolicy::HashVector DoubleHashing::Hash(const void* x, size_t n) const
{ {
HashType h1 = hasher1_(x); HashType h1 = hasher1_(x, n);
HashType h2 = hasher2_(x); HashType h2 = hasher2_(x, n);
HashVector h(K(), 0); HashVector h(K(), 0);
for ( size_t i = 0; i < h.size(); ++i ) for ( size_t i = 0; i < h.size(); ++i )
h[i] = h1 + i * h2; h[i] = h1 + i * h2;

View file

@ -96,15 +96,7 @@ protected:
*/ */
class Hasher { class Hasher {
public: public:
template <typename T> HashType operator()(const void* x, size_t n) const { return h3_(x, n); }
HashType operator()(const T& x) const
{
return h3_(&x, sizeof(x));
}
HashType operator()(const void* x, size_t n) const
{
return h3_(x, n);
}
private: private:
// FIXME: The hardcoded value of 36 comes from UHASH_KEY_SIZE defined in // FIXME: The hardcoded value of 36 comes from UHASH_KEY_SIZE defined in
// Hash.h. I do not know how this value impacts the hash function behavior // Hash.h. I do not know how this value impacts the hash function behavior