Skip to content

Commit d420610

Browse files
authored
Merge pull request #398 from ksahlin/deterministic
Make index creation deterministic
2 parents a0d03e2 + 09296e4 commit d420610

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/randstrobes.hpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ struct RefRandstrobe {
3434
// RefRandstrobes in the index is reproducible no matter which sorting
3535
// function is used. This branchless comparison is faster than the
3636
// equivalent one using std::tie.
37-
__uint128_t lhs = (static_cast<__uint128_t>(hash) << 64) | position;
38-
__uint128_t rhs = (static_cast<__uint128_t>(other.hash) << 64) | other.position;
37+
__uint128_t lhs = (static_cast<__uint128_t>(hash) << 64) | ((static_cast<uint64_t>(position) << 32) | m_packed);
38+
__uint128_t rhs = (static_cast<__uint128_t>(other.hash) << 64) | ((static_cast<uint64_t>(other.position) << 32) | m_packed);
3939
return lhs < rhs;
4040
}
4141

0 commit comments

Comments
 (0)