diff options
| author | 2022-09-01 13:04:26 +0200 | |
|---|---|---|
| committer | 2022-09-01 14:07:46 +0200 | |
| commit | 6ea6819e5a8b6e2b2c818249642e7923db9f81c8 (patch) | |
| tree | 01aeb453d0b18e2cad018970daedb216095ad028 /src/util.hff | |
| parent | 2e0160015d756702a799be95db237b7a91bae400 (diff) | |
on big aggregates big, use a hash map to lookup fields
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; |