Browse files

small cosmetic change

  • Loading branch information...
2 parents 0d99856 + e896c1c commit 3b8ad4c30cb96ad35841d5c9317c1d953d38398c @matz matz committed Jul 8, 2012
Showing with 8 additions and 5 deletions.
  1. +8 −5 src/range.c
View
13 src/range.c
@@ -199,8 +199,10 @@ r_gt(mrb_state *mrb, mrb_value a, mrb_value b)
mrb_value r = mrb_funcall(mrb, a, "<=>", 1, b);
/* output :a < b => -1, a = b => 0, a > b => +1 */
- if (mrb_nil_p(r)) return FALSE;
- if (mrb_obj_equal(mrb, r, mrb_fixnum_value(1))) return TRUE;
+ if (mrb_type(r) == MRB_TT_FIXNUM) {
+ if (mrb_fixnum(r) == 1) return TRUE;
+ }
+
return FALSE;
}
@@ -210,10 +212,11 @@ r_ge(mrb_state *mrb, mrb_value a, mrb_value b)
mrb_value r = mrb_funcall(mrb, a, "<=>", 1, b); /* compare result */
/* output :a < b => -1, a = b => 0, a > b => +1 */
- if (mrb_nil_p(r)) return FALSE;
+ if (mrb_type(r) == MRB_TT_FIXNUM) {
+ int c = mrb_fixnum(r);
+ if (c == 0 || c == 1) return TRUE;
+ }
- if (mrb_obj_equal(mrb, r, mrb_fixnum_value(0))) return TRUE;
- if (mrb_obj_equal(mrb, r, mrb_fixnum_value(1))) return TRUE;
return FALSE;
}

0 comments on commit 3b8ad4c

Please sign in to comment.