Skip to content

Commit

Permalink
Fix point hash to be well distributed.
Browse files Browse the repository at this point in the history
  • Loading branch information
akrieger committed Sep 2, 2024
1 parent 9c09701 commit 6521cd0
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions src/point.h
Original file line number Diff line number Diff line change
Expand Up @@ -303,11 +303,7 @@ namespace std
template <>
struct hash<point> {
std::size_t operator()( const point &k ) const noexcept {
constexpr uint64_t a = 2862933555777941757;
size_t result = k.y;
result *= a;
result += k.x;
return result;
return hash<uint64_t>{}(static_cast<uint64_t>(k.x) << 32 | k.y);
}
};
} // namespace std
Expand Down

0 comments on commit 6521cd0

Please sign in to comment.