aboutsummaryrefslogtreecommitdiff
path: root/src/ir.cpp
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2020-11-23 19:14:36 +0000
committergingerBill <bill@gingerbill.org>2020-11-23 19:14:36 +0000
commita55568b0c480b8a4ba7cf2f24ff2bb41cfc759ff (patch)
tree7f2634130ec16da3655fe292f036173abe4c64c2 /src/ir.cpp
parentb08ec005b29c28917cfe6ae664dcdb7b97f8f6b6 (diff)
Make hash internal key be `uintptr` rather than `u64` to reduce entry size
Diffstat (limited to 'src/ir.cpp')
-rw-r--r--src/ir.cpp5
1 files changed, 4 insertions, 1 deletions
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<irValue *>(ir_allocator(), 1);
args[0] = str;