Skip to content

Commit

Permalink
Hash the keys correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
jltsiren committed Apr 8, 2020
1 parent 40799f0 commit 5451c2b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions include/gbwtgraph/minimizer.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit 5451c2b

Please sign in to comment.