Skip to content

Commit

Permalink
Fix hash implementation for SerializedBlockCache
Browse files Browse the repository at this point in the history
  • Loading branch information
sfan5 committed May 23, 2022
1 parent e16a470 commit 5daafc9
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/server.h
Original file line number Diff line number Diff line change
Expand Up @@ -425,11 +425,10 @@ class Server : public con::PeerHandler, public MapEventReceiver,
std::unordered_set<session_t> waiting_players;
};

// the standard library does not implement std::hash for pairs so we have this:
// The standard library does not implement std::hash for pairs so we have this:
struct SBCHash {
size_t operator() (const std::pair<v3s16, u16> &p) const {
return (((size_t) p.first.X) << 48) | (((size_t) p.first.Y) << 32) |
(((size_t) p.first.Z) << 16) | ((size_t) p.second);
return std::hash<v3s16>()(p.first) ^ p.second;
}
};

Expand Down

0 comments on commit 5daafc9

Please sign in to comment.