Simplify hashing approach map

This commit is contained in:
gingerBill
2020-11-29 15:50:29 +00:00
parent 97c66c9c73
commit 1dfe0cdd1d
6 changed files with 51 additions and 68 deletions
+10
View File
@@ -110,6 +110,16 @@ default_hasher_string :: proc "contextless" (data: rawptr, seed: uintptr) -> uin
}
return uintptr(h);
}
default_hasher_cstring :: proc "contextless" (data: rawptr, seed: uintptr) -> uintptr {
h := u64(seed) + 0xcbf29ce484222325;
ptr := (^uintptr)(data)^;
for (^byte)(ptr)^ != 0 {
b := (^byte)(ptr)^;
h = (h ~ u64(b)) * 0x100000001b3;
ptr += 1;
}
return uintptr(h);
}