summaryrefslogtreecommitdiff
path: root/modules/csg
diff options
context:
space:
mode:
authorreduz <reduzio@gmail.com>2022-06-18 16:20:55 +0200
committerreduz <reduzio@gmail.com>2022-06-20 12:54:19 +0200
commit141c3755814cea60888c7ee548c7ce709550b784 (patch)
treecc5045d98995b754097d1dde100f0138033fc735 /modules/csg
parent8e3d9a23aa0a724d3dd25fcf0e8085b5a438c233 (diff)
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)
Diffstat (limited to 'modules/csg')
-rw-r--r--modules/csg/csg.h6
-rw-r--r--modules/csg/csg_shape.h6
2 files changed, 6 insertions, 6 deletions
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;
}
};