diff options
| author | gingerBill <bill@gingerbill.org> | 2021-03-23 23:34:01 +0000 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2021-03-23 23:34:01 +0000 |
| commit | fc1a352285bab119752ff32edd44f8fe4260c352 (patch) | |
| tree | d080e93bef2c4011a8ce7f37d185acc27e71494f /src/ir.cpp | |
| parent | 082381284c36c605431d023ed9ae797678d65731 (diff) | |
For `bit_set`, allow `+` and `-` to be aliases for `|` and `&~`, respectively
Diffstat (limited to 'src/ir.cpp')
| -rw-r--r-- | src/ir.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
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: { |