summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2024-06-08 08:20:12 +0200
committerStanislaw Halik <sthalik@misaki.pl>2024-06-08 10:38:53 +0200
commit39670daf26c4fbbfe9148dec30c9f0e075eff404 (patch)
tree50778183928c5aad1a9308a86852bb4a68581b30 /src
parent63edd105d758a39b856f9099b339de30895df8ac (diff)
improve hash api and hash test
Diffstat (limited to 'src')
-rw-r--r--src/point.cpp8
-rw-r--r--src/world.hpp5
2 files changed, 4 insertions, 9 deletions
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<chunk_coords_, chunk, chunk_coords_hasher> _chunks;
safe_ptr<robin_map_wrapper> _objects;
std::shared_ptr<char> _unique_id = std::make_shared<char>('A');