Minor tokenizer performance improvements

This commit is contained in:
gingerBill
2020-05-27 12:32:11 +01:00
parent 098699103d
commit 6ac0fb80a6
5 changed files with 143 additions and 59 deletions

View File

@@ -158,7 +158,15 @@ GB_ALLOCATOR_PROC(heap_allocator_proc) {
#include "range_cache.cpp"
u32 fnv32a(void const *data, isize len) {
u8 const *bytes = cast(u8 const *)data;
u32 h = 0x811c9dc5;
for (isize i = 0; i < len; i++) {
u32 b = cast(u32)bytes[i];
h = (h ^ b) * 0x01000193;
}
return h;
}
u64 fnv64a(void const *data, isize len) {
u8 const *bytes = cast(u8 const *)data;