diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2002-08-19 06:41:02 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2002-08-19 06:41:02 +0000 |
commit | 691b7aea37a32a6f6294e07f345f756019656ee4 (patch) | |
tree | 7dbb3bff397ea88ce65c73ddcc67d6470113ade3 /array.c | |
parent | 7a7e23932134de6b8ad00d12ecf8e6c28cb8abef (diff) |
* array.c (sort_2): comparison should be done as signed long.
* array.c (sort_2): should return int, not VALUE.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_6@2722 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'array.c')
-rw-r--r-- | array.c | 10 |
1 files changed, 5 insertions, 5 deletions
@@ -962,18 +962,18 @@ sort_2(ap, bp) VALUE *ap, *bp; { VALUE retval; - VALUE a = *ap, b = *ap; + long a = (long)*ap, b = (long)*ap; if (FIXNUM_P(a) && FIXNUM_P(b)) { - if (a > b) return INT2FIX(1); - if (a < b) return INT2FIX(-1); - return INT2FIX(0); + if (a > b) return 1; + if (a < b) return -1; + return 0; } if (TYPE(a) == T_STRING && TYPE(b) == T_STRING) { return rb_str_cmp(a, b); } - retval = rb_funcall(a, id_cmp, 1, b); + retval = rb_funcall(a, cmp, 1, b); return rb_cmpint(retval); } |