diff options
| author | gingerBill <bill@gingerbill.org> | 2018-12-02 19:27:42 +0000 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2018-12-02 19:27:42 +0000 |
| commit | 17b0e3a1a1017a3f2afc8fd47fc7451d65eb33cd (patch) | |
| tree | f028923c2bb40dbcc7b22eb1327b0446fe28686e /src/ir.cpp | |
| parent | 28583bfff88ff1378a0e71030701071dcfd37462 (diff) | |
Fix bit sets with custom endian underlying type
Diffstat (limited to 'src/ir.cpp')
| -rw-r--r-- | src/ir.cpp | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/ir.cpp b/src/ir.cpp index 49482b7ea..bf595251e 100644 --- a/src/ir.cpp +++ b/src/ir.cpp @@ -6250,13 +6250,13 @@ irValue *ir_build_expr_internal(irProcedure *proc, Ast *expr) { Type *key_type = rt->BitSet.elem; GB_ASSERT(are_types_identical(ir_type(left), key_type)); + Type *it = bit_set_to_int(rt); - left = ir_emit_conv(proc, left, it); irValue *lower = ir_value_constant(it, exact_value_i64(rt->BitSet.lower)); - irValue *key = ir_emit_arith(proc, Token_Sub, left, lower, it); - irValue *bit = ir_emit_arith(proc, Token_Shl, v_one, key, it); - + irValue *key = ir_emit_arith(proc, Token_Sub, left, lower, ir_type(left)); + irValue *bit = ir_emit_arith(proc, Token_Shl, v_one, key, ir_type(left)); + bit = ir_emit_conv(proc, bit, it); irValue *old_value = ir_emit_bitcast(proc, right, it); irValue *new_value = ir_emit_arith(proc, Token_And, old_value, bit, it); @@ -7228,7 +7228,6 @@ irAddr ir_build_addr(irProcedure *proc, Ast *expr) { } case Type_BitSet: { - i64 sz = type_size_of(type); if (cl->elems.count > 0 && sz > 0) { ir_emit_store(proc, v, ir_add_module_constant(proc->module, type, exact_value_compound(expr))); |