Use hash64.
This commit is contained in:
parent
fd0bc2ae43
commit
498884327a
@ -158,8 +158,8 @@ bool MPHIndex::Mapping(
|
|||||||
TriGraph graph(n_, m_);
|
TriGraph graph(n_, m_);
|
||||||
for (ForwardIterator it = begin; it != end; ++it) {
|
for (ForwardIterator it = begin; it != end; ++it) {
|
||||||
uint32_t h[4];
|
uint32_t h[4];
|
||||||
// SeededHashFcn().hash64(*it, hash_seed_[0], reinterpret_cast<uint32_t*>(&h));
|
SeededHashFcn().hash64(*it, hash_seed_[0], reinterpret_cast<uint32_t*>(&h));
|
||||||
for (int i = 0; i < 3; ++i) h[i] = SeededHashFcn()(*it, hash_seed_[i]);
|
// for (int i = 0; i < 3; ++i) h[i] = SeededHashFcn()(*it, hash_seed_[i]);
|
||||||
uint32_t v0 = h[0] % r_;
|
uint32_t v0 = h[0] % r_;
|
||||||
uint32_t v1 = h[1] % r_ + r_;
|
uint32_t v1 = h[1] % r_ + r_;
|
||||||
uint32_t v2 = h[2] % r_ + (r_ << 1);
|
uint32_t v2 = h[2] % r_ + (r_ << 1);
|
||||||
@ -175,8 +175,9 @@ bool MPHIndex::Mapping(
|
|||||||
|
|
||||||
template <class SeededHashFcn, class Key>
|
template <class SeededHashFcn, class Key>
|
||||||
uint32_t MPHIndex::perfect_hash(const Key& key) const {
|
uint32_t MPHIndex::perfect_hash(const Key& key) const {
|
||||||
uint32_t h[3];
|
uint32_t h[4];
|
||||||
for (int i = 0; i < 3; ++i) h[i] = SeededHashFcn()(key, hash_seed_[i]);
|
SeededHashFcn().hash64(key, hash_seed_[0], reinterpret_cast<uint32_t*>(&h));
|
||||||
|
// for (int i = 0; i < 3; ++i) h[i] = SeededHashFcn()(key, hash_seed_[i]);
|
||||||
assert(r_);
|
assert(r_);
|
||||||
h[0] = h[0] % r_;
|
h[0] = h[0] % r_;
|
||||||
h[1] = h[1] % r_ + r_;
|
h[1] = h[1] % r_ + r_;
|
||||||
|
Loading…
Reference in New Issue
Block a user