Merge pull request #1634 from cremno/use-mrb_fixnum_p

tiny word boxing optimization
This commit is contained in:
Yukihiro "Matz" Matsumoto
2014-01-02 15:46:00 -08:00
7 changed files with 13 additions and 20 deletions
+2 -2
View File
@@ -313,7 +313,7 @@ mrb_ary_cmp(mrb_state *mrb, mrb_value ary1)
for (i=0; i<len; i++) {
mrb_value v = ary_elt(ary2, i);
r = mrb_funcall_argv(mrb, ary_elt(ary1, i), cmp, 1, &v);
if (mrb_type(r) != MRB_TT_FIXNUM || mrb_fixnum(r) != 0) return r;
if (!mrb_fixnum_p(r) || mrb_fixnum(r) != 0) return r;
}
}
len = a1->len - a2->len;
@@ -692,7 +692,7 @@ mrb_ary_aget(mrb_state *mrb, mrb_value self)
return mrb_ary_ref(mrb, self, index);
case 1:
if (mrb_type(argv[0]) != MRB_TT_FIXNUM) {
if (!mrb_fixnum_p(argv[0])) {
mrb_raise(mrb, E_TYPE_ERROR, "expected Fixnum");
}
if (index < 0) index += a->len;