From 6ea6819e5a8b6e2b2c818249642e7923db9f81c8 Mon Sep 17 00:00:00 2001 From: lemon Date: Thu, 1 Sep 2022 13:04:26 +0200 Subject: on big aggregates big, use a hash map to lookup fields --- src/util.hff | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/util.hff') 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; -- cgit v1.2.3