summaryrefslogtreecommitdiffhomepage
path: root/mrbgems/mruby-compiler
diff options
context:
space:
mode:
Diffstat (limited to 'mrbgems/mruby-compiler')
-rw-r--r--mrbgems/mruby-compiler/core/codegen.c22
1 files changed, 6 insertions, 16 deletions
diff --git a/mrbgems/mruby-compiler/core/codegen.c b/mrbgems/mruby-compiler/core/codegen.c
index d5f8f8bb0..be5231162 100644
--- a/mrbgems/mruby-compiler/core/codegen.c
+++ b/mrbgems/mruby-compiler/core/codegen.c
@@ -2486,24 +2486,18 @@ codegen(codegen_scope *s, node *tree, int val)
if (i < 0) {
if (i == -1) genop_1(s, OP_LOADI__1, cursp());
else if (i >= -0xff) genop_2(s, OP_LOADINEG, cursp(), (uint16_t)-i);
- else if (i >= -0x8000) genop_2S(s, OP_LOADI16, cursp(), (uint16_t)i);
-#ifdef MRB_INT64
- else if (i >= -(int32_t)0x80000000) genop_2SS(s, OP_LOADI32, cursp(), (uint32_t)i);
+ else if (i >= INT16_MIN) genop_2S(s, OP_LOADI16, cursp(), (uint16_t)i);
+ else if (i >= INT32_MIN) genop_2SS(s, OP_LOADI32, cursp(), (uint32_t)i);
else goto lit_int;
-#else
- else genop_2SS(s, OP_LOADI32, cursp(), (uint32_t)i);
-#endif
}
else if (i < 8) genop_1(s, OP_LOADI_0 + (uint8_t)i, cursp());
else if (i <= 0xff) genop_2(s, OP_LOADI, cursp(), (uint16_t)i);
- else if (i <= 0x7fff) genop_2S(s, OP_LOADI16, cursp(), (uint16_t)i);
- else if (i <= 0x7fffffff) genop_2SS(s, OP_LOADI32, cursp(), (uint32_t)i);
+ else if (i <= INT16_MAX) genop_2S(s, OP_LOADI16, cursp(), (uint16_t)i);
+ else if (i <= INT32_MAX) genop_2SS(s, OP_LOADI32, cursp(), (uint32_t)i);
else {
int off;
-#ifdef MRB_INT64
lit_int:
-#endif
off = new_lit(s, mrb_int_value(s->mrb, i));
genop_bs(s, OP_LOADL, cursp(), off);
}
@@ -2563,20 +2557,16 @@ codegen(codegen_scope *s, node *tree, int val)
else if (i >= -0xff) {
genop_2(s, OP_LOADINEG, cursp(), (uint16_t)-i);
}
- else if (i >= -0x8000) {
+ else if (i >= INT16_MIN) {
genop_2S(s, OP_LOADI16, cursp(), (uint16_t)i);
}
-#ifdef MRB_INT32
- else genop_2SS(s, OP_LOADI32, cursp(), (uint32_t)i);
-#else
- else if (i >= -0x80000000) {
+ else if (i >= INT32_MIN) {
genop_2SS(s, OP_LOADI32, cursp(), (uint32_t)i);
}
else {
int off = new_lit(s, mrb_int_value(s->mrb, i));
genop_bs(s, OP_LOADL, cursp(), off);
}
-#endif
#ifndef MRB_NO_FLOAT
}
#endif