Add TypeWriter stream to allow for in-place hashing and string generation

This commit is contained in:
gingerBill
2025-02-18 14:21:40 +00:00
parent 19b59461b0
commit cc90e0cbbf
3 changed files with 274 additions and 180 deletions

View File

@@ -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;