aboutsummaryrefslogtreecommitdiff
path: root/src/llvm_backend_utility.cpp
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2022-11-08 11:04:37 +0000
committergingerBill <bill@gingerbill.org>2022-11-08 11:04:37 +0000
commite3e225d21b613d789ebad0273b198b5509800bf0 (patch)
tree0b837006d0fa86c79211bf418e510858144892e3 /src/llvm_backend_utility.cpp
parent50e10ceb3b94d7816239b1ac5d840da83c75b3d1 (diff)
Support `for in` loops for `map`
Diffstat (limited to 'src/llvm_backend_utility.cpp')
-rw-r--r--src/llvm_backend_utility.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/llvm_backend_utility.cpp b/src/llvm_backend_utility.cpp
index dce74126e..cbe690155 100644
--- a/src/llvm_backend_utility.cpp
+++ b/src/llvm_backend_utility.cpp
@@ -1464,7 +1464,13 @@ lbValue lb_map_cap(lbProcedure *p, lbValue value) {
lbValue lb_map_data_uintptr(lbProcedure *p, lbValue value) {
GB_ASSERT(is_type_map(value.type));
lbValue data = lb_emit_struct_ev(p, value, 0);
- lbValue mask = lb_const_int(p->module, t_uintptr, MAP_CACHE_LINE_SIZE-1);
+ u64 mask_value = 0;
+ if (build_context.word_size == 4) {
+ mask_value = 0xfffffffful & ~(MAP_CACHE_LINE_SIZE-1);
+ } else {
+ mask_value = 0xffffffffffffffffull & ~(MAP_CACHE_LINE_SIZE-1);
+ }
+ lbValue mask = lb_const_int(p->module, t_uintptr, mask_value);
return lb_emit_arith(p, Token_And, data, mask, t_uintptr);
}