From b71eac2069a30349435c192d682e865718c86a15 Mon Sep 17 00:00:00 2001 From: Clement Sibille Date: Mon, 5 May 2025 08:32:33 +0200 Subject: Add a vulkan renderer that renders an OBJ --- src/hash.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 src/hash.c (limited to 'src/hash.c') 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 + +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; +} -- cgit v1.2.3