Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions src/core/util/BitSet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -233,12 +233,11 @@ int32_t BitSet::hashCode() {
// Start with a zero hash and use a mix that results in zero if the input is zero.
// This effectively truncates trailing zeros without an explicit check.
int64_t hash = 0;
to_block_range(bitSet, boost::make_function_output_iterator(
[&hash](bitset_type::block_type block) {
hash ^= block;
hash = (hash << 1) | (hash >> 63); // rotate left
}
));
auto computeHash = [&hash](bitset_type::block_type block) {
hash ^= block;
hash = (hash << 1) | (hash >> 63); // rotate left
};
to_block_range(bitSet, boost::make_function_output_iterator(std::ref(computeHash)));
// Fold leftmost bits into right and add a constant to prevent empty sets from
// returning 0, which is too common.
return (int32_t)((hash >> 32) ^ hash) + 0x98761234;
Expand Down