aboutsummaryrefslogtreecommitdiff
path: root/src/common.cpp
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2025-02-18 14:21:40 +0000
committergingerBill <bill@gingerbill.org>2025-02-18 14:32:41 +0000
commit23efd1bd02703e12a4d97c2d7194d1175a28d56c (patch)
tree313de6cf09ca33d9bd334c69c2755c610c29f691 /src/common.cpp
parent19b59461b04f4b6b63fa24d70e9c9376b3dd3249 (diff)
Add `TypeWriter` stream to allow for in-place hashing and string generation
Diffstat (limited to 'src/common.cpp')
-rw-r--r--src/common.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/common.cpp b/src/common.cpp
index 0ef39bd10..ad1e5a851 100644
--- a/src/common.cpp
+++ b/src/common.cpp
@@ -134,9 +134,9 @@ gb_internal u32 fnv32a(void const *data, isize len) {
return h;
}
-gb_internal u64 fnv64a(void const *data, isize len) {
+gb_internal u64 fnv64a(void const *data, isize len, u64 seed=0xcbf29ce484222325ull) {
u8 const *bytes = cast(u8 const *)data;
- u64 h = 0xcbf29ce484222325ull;
+ u64 h = seed;
for (; len >= 8; len -= 8, bytes += 8) {
h = (h ^ bytes[0]) * 0x100000001b3ull;