summaryrefslogtreecommitdiff
path: root/range.c
diff options
context:
space:
mode:
Diffstat (limited to 'range.c')
-rw-r--r--range.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/range.c b/range.c
index ae172be4e7..01524e15e0 100644
--- a/range.c
+++ b/range.c
@@ -310,8 +310,11 @@ range_step(int argc, VALUE *argv, VALUE range)
rb_scan_args(argc, argv, "01", &step);
tmp = rb_check_to_integer(step, "to_int");
if (!NIL_P(tmp)) {
+ if (FIXNUM_P(tmp))
+ unit = FIX2LONG(tmp);
+ else
+ unit = rb_cmpint(tmp, step, INT2FIX(0));
step = tmp;
- unit = NUM2LONG(step);
}
else {
tmp = rb_funcall(rb_funcall(b, '+', 1, step), '-', 1, b);