@@ -253,12 +253,6 @@ coerce_rescue(VALUE *x)
253
253
return Qnil ; /* dummy */
254
254
}
255
255
256
- static VALUE
257
- coerce_rescue_quiet (VALUE arg , VALUE errinfo )
258
- {
259
- return Qundef ;
260
- }
261
-
262
256
static int
263
257
do_coerce (VALUE * x , VALUE * y , int err )
264
258
{
@@ -1870,34 +1864,6 @@ ruby_num_interval_step_size(VALUE from, VALUE to, VALUE step, int excl)
1870
1864
}
1871
1865
}
1872
1866
1873
- static VALUE
1874
- num_step_compare_with_zero (VALUE num )
1875
- {
1876
- VALUE zero = INT2FIX (0 );
1877
- return rb_check_funcall (num , '>' , 1 , & zero );
1878
- }
1879
-
1880
- static int
1881
- num_step_negative_p (VALUE num )
1882
- {
1883
- const ID mid = '<' ;
1884
- VALUE r ;
1885
-
1886
- if (FIXNUM_P (num )) {
1887
- if (method_basic_p (rb_cFixnum ))
1888
- return (SIGNED_VALUE )num < 0 ;
1889
- }
1890
- else if (RB_TYPE_P (num , T_BIGNUM )) {
1891
- if (method_basic_p (rb_cBignum ))
1892
- return RBIGNUM_NEGATIVE_P (num );
1893
- }
1894
- r = rb_rescue (num_step_compare_with_zero , num , coerce_rescue_quiet , Qnil );
1895
- if (r == Qundef ) {
1896
- coerce_failed (num , INT2FIX (0 ));
1897
- }
1898
- return !RTEST (r );
1899
- }
1900
-
1901
1867
static int
1902
1868
num_step_scan_args (int argc , const VALUE * argv , VALUE * to , VALUE * step )
1903
1869
{
@@ -1932,7 +1898,7 @@ num_step_scan_args(int argc, const VALUE *argv, VALUE *to, VALUE *step)
1932
1898
if (NIL_P (* step )) {
1933
1899
* step = INT2FIX (1 );
1934
1900
}
1935
- desc = num_step_negative_p (* step );
1901
+ desc = ! positive_int_p (* step );
1936
1902
if (NIL_P (* to )) {
1937
1903
* to = desc ? DBL2NUM (- INFINITY ) : DBL2NUM (INFINITY );
1938
1904
}
0 commit comments