diff options
Diffstat (limited to 'src/util.hff')
| -rw-r--r-- | src/util.hff | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/util.hff b/src/util.hff index 19c8c41..b8416f1 100644 --- a/src/util.hff +++ b/src/util.hff @@ -7,6 +7,15 @@ def FNV1A_INI u32 = 0x811c9dc5; extern fn fnv1a(h u32, [#]const u8) u32; extern fn fnv1a_s(h u32, *const u8) u32; extern fn fnv1a_i(h u32, i64) u32; +fn cwhash32(x u32) u32 { + // https://nullprogram.com/blog/2018/07/31/ + x ^= x >> 16; + x *= 0x7feb352dU; + x ^= x >> 15; + x *= 0x846ca68bU; + x ^= x >> 16; + return x; +} extern fn addfilepath(*const u8) int; extern fn fileid2path(id int) *const u8; extern fn internstr(*const u8) *const u8; |