Fixed wrong casting in OP_LOADI32.

Negative integer `>-65535` had wrong value, e,g, `p(-40550)` printed
`4294926746` since Nov. 2020, sigh.
This commit is contained in:
Yukihiro "Matz" Matsumoto
2021-01-02 13:22:55 +09:00
parent c1f05a7fb3
commit b151a697e0
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -172,7 +172,7 @@ codedump(mrb_state *mrb, const mrb_irep *irep)
print_lv_a(mrb, irep, a);
break;
CASE(OP_LOADI32, BSS);
printf("OP_LOADI32\tR%d\t%d\t", a, (int)(((uint32_t)b<<16)+c));
printf("OP_LOADI32\tR%d\t%d\t", a, (int32_t)(((uint32_t)b<<16)+c));
print_lv_a(mrb, irep, a);
break;
CASE(OP_LOADI__1, B);
+1 -1
View File
@@ -1134,7 +1134,7 @@ RETRY_TRY_BLOCK:
}
CASE(OP_LOADI32, BSS) {
SET_INT_VALUE(mrb, regs[a], (mrb_int)(((uint32_t)b<<16)+c));
SET_INT_VALUE(mrb, regs[a], (int32_t)(((uint32_t)b<<16)+c));
NEXT;
}