summaryrefslogtreecommitdiffstats
path: root/src/hash.c
diff options
context:
space:
mode:
authorClement Sibille <clements@lisible.xyz>2025-05-05 08:32:33 +0200
committerClement Sibille <clements@lisible.xyz>2025-05-05 12:24:27 +0200
commitb71eac2069a30349435c192d682e865718c86a15 (patch)
tree33754245a23533e31e6a83390bf190c11dfe2bb9 /src/hash.c
parent6017db0069977ae85e698a1234f4a2b7632ee495 (diff)
Add a vulkan renderer that renders an OBJ
Diffstat (limited to '')
-rw-r--r--src/hash.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/hash.c b/src/hash.c
new file mode 100644
index 0000000..cfdafc3
--- /dev/null
+++ b/src/hash.c
@@ -0,0 +1,15 @@
+#include "hash.h"
+#include <assert.h>
+
+uint64_t vgltf_hash_fnv_1a(const char *bytes, size_t nbytes) {
+ assert(bytes);
+ static const uint64_t FNV_OFFSET_BASIS = 14695981039346656037u;
+ static const uint64_t FNV_PRIME = 1099511628211u;
+ uint64_t hash = FNV_OFFSET_BASIS;
+ for (size_t i = 0; i < nbytes; i++) {
+ hash = hash ^ bytes[i];
+ hash = hash * FNV_PRIME;
+ }
+
+ return hash;
+}
Go back to lisible.xyz