mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
codegen.c: skip ADDI/SUBI for zero operand.
This commit is contained in:
@@ -781,6 +781,7 @@ gen_addsub(codegen_scope *s, uint8_t op, uint16_t dst)
|
||||
/* OP_ADDI/OP_SUBI takes upto 16bits */
|
||||
if (n > INT16_MAX || n < INT16_MIN) goto normal;
|
||||
rewind_pc(s);
|
||||
if (n == 0) return;
|
||||
if (n > 0) {
|
||||
if (op == OP_ADD) genop_2(s, OP_ADDI, dst, (uint16_t)n);
|
||||
else genop_2(s, OP_SUBI, dst, (uint16_t)n);
|
||||
|
||||
Reference in New Issue
Block a user