From 39670daf26c4fbbfe9148dec30c9f0e075eff404 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sat, 8 Jun 2024 08:20:12 +0200 Subject: improve hash api and hash test --- src/point.cpp | 8 +------- src/world.hpp | 5 +++-- 2 files changed, 4 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/point.cpp b/src/point.cpp index 1c62b2ad..6cd2903b 100644 --- a/src/point.cpp +++ b/src/point.cpp @@ -8,13 +8,7 @@ size_t point::hash() const { constexpr size_t size = 2 * 2 + 1 + 1 + 2; static_assert(sizeof *this == size); -#ifdef FLOORMAT_64 - static_assert(sizeof nullptr > 4); - return hash_64(this, sizeof *this); -#else - static_assert(sizeof nullptr == 4); - return hash_32(this, sizeof *this); -#endif + return hash_buf(this, sizeof *this); } Debug& operator<<(Debug& dbg, const point& pt) diff --git a/src/world.hpp b/src/world.hpp index 420e8894..ecd58e3c 100644 --- a/src/world.hpp +++ b/src/world.hpp @@ -26,6 +26,8 @@ public: static constexpr float max_load_factor = .25; static constexpr size_t initial_collect_every = 64; + struct chunk_coords_hasher { size_t operator()(const chunk_coords_& coord) const noexcept; }; + private: struct chunk_tuple { @@ -35,9 +37,8 @@ private: } _last_chunk; struct object_id_hasher { size_t operator()(object_id id) const noexcept; }; - struct chunk_coords_hasher { size_t operator()(const chunk_coords_& coord) const noexcept; }; - struct robin_map_wrapper; + struct robin_map_wrapper; std::unordered_map _chunks; safe_ptr _objects; std::shared_ptr _unique_id = std::make_shared('A'); -- cgit v1.2.3