diff options
| author | Ginger Bill <bill@gingerbill.org> | 2017-06-05 23:06:15 +0100 |
|---|---|---|
| committer | Ginger Bill <bill@gingerbill.org> | 2017-06-05 23:06:15 +0100 |
| commit | d2e7d730ac88bf0ce4f9c823085d7880c30db01e (patch) | |
| tree | a60d484850e5b83a32a94a76ab77c095bc22f6e1 /src/common.c | |
| parent | 817e4b663e111f768a8fe9af4d3bc53f56de08b6 (diff) | |
Fix key generation for constant strings in IR
Diffstat (limited to 'src/common.c')
| -rw-r--r-- | src/common.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/common.c b/src/common.c index f7d16cf8a..54d938c92 100644 --- a/src/common.c +++ b/src/common.c @@ -19,6 +19,16 @@ gbAllocator heap_allocator(void) { #include "integer128.c" #include "murmurhash3.c" +u128 fnv128a(void const *data, isize len) { + u128 o = u128_lo_hi(0x13bull, 0x1000000ull); + u128 h = u128_lo_hi(0x62b821756295c58dull, 0x6c62272e07bb0142ull); + u8 const *bytes = cast(u8 const *)data; + for (isize i = 0; i < len; i++) { + h = u128_mul(u128_xor(h, u128_from_u64(bytes[i])), o); + } + return h; +} + gb_global String global_module_path = {0}; gb_global bool global_module_path_set = false; |