aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsfan5 <sfan5@live.de>2022-05-22 00:37:58 +0200
committersfan5 <sfan5@live.de>2022-05-23 22:50:58 +0200
commit5daafc9d336d3f946854874e56a38ae9ac130811 (patch)
tree142ee0a8244f147bfbd54ffb6f3190660acbc690
parente16a470d59069692d654f5c1529ab313a01ded67 (diff)
downloadminetest-5daafc9d336d3f946854874e56a38ae9ac130811.tar.gz
minetest-5daafc9d336d3f946854874e56a38ae9ac130811.tar.bz2
minetest-5daafc9d336d3f946854874e56a38ae9ac130811.zip
Fix hash implementation for SerializedBlockCache
-rw-r--r--src/server.h5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/server.h b/src/server.h
index 2c21f5dfc..71f692e87 100644
--- a/src/server.h
+++ b/src/server.h
@@ -425,11 +425,10 @@ private:
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;
}
};