From a55568b0c480b8a4ba7cf2f24ff2bb41cfc759ff Mon Sep 17 00:00:00 2001 From: gingerBill Date: Mon, 23 Nov 2020 19:14:36 +0000 Subject: Make hash internal key be `uintptr` rather than `u64` to reduce entry size --- src/ir.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/ir.cpp') diff --git a/src/ir.cpp b/src/ir.cpp index e9f0b5647..b545e7ce3 100644 --- a/src/ir.cpp +++ b/src/ir.cpp @@ -3624,7 +3624,10 @@ irValue *ir_gen_map_hash(irProcedure *proc, irValue *key, Type *key_type) { ExactValue ev = str->Constant.value; GB_ASSERT(ev.kind == ExactValue_String); u64 hs = fnv64a(ev.value_string.text, ev.value_string.len); - hashed_str = ir_value_constant(t_u64, exact_value_u64(hs)); + if (build_context.word_size == 4) { + hs &= 0xffffffff; + } + hashed_str = ir_value_constant(t_uintptr, exact_value_u64(hs)); } else { auto args = array_make(ir_allocator(), 1); args[0] = str; -- cgit v1.2.3