From d5823623edad1e1c5444d98cc6fc52bd5b8b7975 Mon Sep 17 00:00:00 2001 From: Hoshiumi Arata Date: Tue, 19 Nov 2024 23:36:22 +0900 Subject: [PATCH] Change the limits of OP_ADDI and OP_SUBI from 0-127 to 0-255. --- mrbgems/mruby-compiler/core/codegen.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mrbgems/mruby-compiler/core/codegen.c b/mrbgems/mruby-compiler/core/codegen.c index e9d0ade11..5c99df132 100644 --- a/mrbgems/mruby-compiler/core/codegen.c +++ b/mrbgems/mruby-compiler/core/codegen.c @@ -817,7 +817,7 @@ gen_addsub(codegen_scope *s, uint8_t op, uint16_t dst) mrb_int n0; if (addr_pc(s, data.addr) == s->lastlabel || !get_int_operand(s, &data0, &n0)) { /* OP_ADDI/OP_SUBI takes upto 8bits */ - if (n > INT8_MAX || n < INT8_MIN) goto normal; + if (n > UINT8_MAX || n < -UINT8_MAX) goto normal; rewind_pc(s); if (n == 0) return; if (n > 0) {