From 5451c2bdcc61957ba4a161426371c91e138eff4b Mon Sep 17 00:00:00 2001 From: Jouni Siren Date: Tue, 7 Apr 2020 22:21:22 -0700 Subject: [PATCH] Hash the keys correctly --- include/gbwtgraph/minimizer.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/gbwtgraph/minimizer.h b/include/gbwtgraph/minimizer.h index 9146f84..9a915e7 100644 --- a/include/gbwtgraph/minimizer.h +++ b/include/gbwtgraph/minimizer.h @@ -149,7 +149,7 @@ struct Key64 void set_pointer() { this->key |= IS_POINTER; } // Hash of the key. - size_t hash() const { return wang_hash_64(this->key); } + size_t hash() const { return wang_hash_64(this->key & KEY_MASK); } // Move the kmer forward, with c as the next character. Update the key, assuming that // it encodes the kmer in forward orientation. @@ -256,7 +256,7 @@ struct Key128 // Hash of the key. Essentially boost::hash_combine. size_t hash() const { - size_t result = wang_hash_64(this->high); + size_t result = wang_hash_64(this->high & KEY_MASK); result ^= wang_hash_64(this->low) + 0x9e3779b9 + (result << 6) + (result >> 2); return result; }