From 141c3755814cea60888c7ee548c7ce709550b784 Mon Sep 17 00:00:00 2001 From: reduz Date: Sat, 18 Jun 2022 16:20:55 +0200 Subject: Clean up Hash Functions Clean up and do fixes to hash functions and newly introduced murmur3 hashes in #61934 * Clean up usage of murmur3 * Fixed usages of binary murmur3 on floats (this is invalid) * Changed DJB2 to use xor (which seems to be better) --- modules/csg/csg.h | 6 +++--- modules/csg/csg_shape.h | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'modules/csg') diff --git a/modules/csg/csg.h b/modules/csg/csg.h index 53a9e5d722..738e3d68ea 100644 --- a/modules/csg/csg.h +++ b/modules/csg/csg.h @@ -130,9 +130,9 @@ struct CSGBrushOperation { struct VertexKeyHash { static _FORCE_INLINE_ uint32_t hash(const VertexKey &p_vk) { - uint32_t h = hash_djb2_one_32(p_vk.x); - h = hash_djb2_one_32(p_vk.y, h); - h = hash_djb2_one_32(p_vk.z, h); + uint32_t h = hash_murmur3_one_32(p_vk.x); + h = hash_murmur3_one_32(p_vk.y, h); + h = hash_murmur3_one_32(p_vk.z, h); return h; } }; diff --git a/modules/csg/csg_shape.h b/modules/csg/csg_shape.h index 0eaf5c3727..0b49dc4609 100644 --- a/modules/csg/csg_shape.h +++ b/modules/csg/csg_shape.h @@ -74,9 +74,9 @@ private: struct Vector3Hasher { _ALWAYS_INLINE_ uint32_t hash(const Vector3 &p_vec3) const { - uint32_t h = hash_djb2_one_float(p_vec3.x); - h = hash_djb2_one_float(p_vec3.y, h); - h = hash_djb2_one_float(p_vec3.z, h); + uint32_t h = hash_murmur3_one_float(p_vec3.x); + h = hash_murmur3_one_float(p_vec3.y, h); + h = hash_murmur3_one_float(p_vec3.z, h); return h; } }; -- cgit v1.2.3