From fc1a352285bab119752ff32edd44f8fe4260c352 Mon Sep 17 00:00:00 2001 From: gingerBill Date: Tue, 23 Mar 2021 23:34:01 +0000 Subject: For `bit_set`, allow `+` and `-` to be aliases for `|` and `&~`, respectively --- src/ir.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/ir.cpp') diff --git a/src/ir.cpp b/src/ir.cpp index 5e91d4f30..d17951f9f 100644 --- a/src/ir.cpp +++ b/src/ir.cpp @@ -4621,6 +4621,15 @@ irValue *ir_emit_arith(irProcedure *proc, TokenKind op, irValue *left, irValue * } handle_op: + + // NOTE(bill): Bit Set Aliases for + and - + if (is_type_bit_set(type)) { + switch (op) { + case Token_Add: op = Token_Or; break; + case Token_Sub: op = Token_AndNot; break; + } + } + switch (op) { case Token_Shl: { -- cgit v1.2.3