]> git.lizzy.rs Git - dragonfireclient.git/commitdiff
Fix hash implementation for SerializedBlockCache
authorsfan5 <sfan5@live.de>
Sat, 21 May 2022 22:37:58 +0000 (00:37 +0200)
committersfan5 <sfan5@live.de>
Mon, 23 May 2022 20:50:58 +0000 (22:50 +0200)
src/server.h

index 2c21f5dfc899c5a812b39a1a9f28f96ea4e06773..71f692e872a696aaaf665fa1229e02bb2d993df2 100644 (file)
@@ -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;
                }
        };