Make hash internal key be uintptr rather than u64 to reduce entry size

This commit is contained in:
gingerBill
2020-11-23 19:14:36 +00:00
parent b08ec005b2
commit a55568b0c4
4 changed files with 44 additions and 37 deletions

View File

@@ -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<irValue *>(ir_allocator(), 1);
args[0] = str;