summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorLanza <[email protected]>2020-05-06 14:54:26 +0800
committerYukihiro "Matz" Matsumoto <[email protected]>2020-10-12 16:21:42 +0900
commit1835753f9f20220065346344ca39ae34e2e41270 (patch)
tree63be9cceb32b5bac1489ce8b91f7e4b43754cdc3
parent424afa4446b78e918c11b644451d3f25217084c5 (diff)
downloadmruby-1835753f9f20220065346344ca39ae34e2e41270.tar.gz
mruby-1835753f9f20220065346344ca39ae34e2e41270.zip
Update vm.c
-rw-r--r--src/vm.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/vm.c b/src/vm.c
index 48dea94fb..068d1a977 100644
--- a/src/vm.c
+++ b/src/vm.c
@@ -2320,8 +2320,17 @@ RETRY_TRY_BLOCK:
}
break;
#else
+ #ifdef MRB_INTEGER_DIVISION
+ {
+ mrb_int x = mrb_fixnum(regs[a]);
+ mrb_int y = mrb_fixnum(regs[a+1]);
+ SET_INT_VALUE(regs[a], y ? x / y : 0);
+ NEXT;
+ }
+ #else
x = (mrb_float)mrb_fixnum(regs[a]);
y = (mrb_float)mrb_fixnum(regs[a+1]);
+ #endif
break;
case TYPES2(MRB_TT_FIXNUM,MRB_TT_FLOAT):
x = (mrb_float)mrb_fixnum(regs[a]);