mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* 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/trunk@2722 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
ae23000c0e
commit
b818cdfaf3
2 changed files with 10 additions and 4 deletions
|
@ -1,3 +1,9 @@
|
|||
Mon Aug 19 15:38:44 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||
|
||||
* array.c (sort_2): comparison should be done as signed long.
|
||||
|
||||
* array.c (sort_2): should return int, not VALUE.
|
||||
|
||||
Mon Aug 19 12:38:33 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
|
||||
|
||||
* eval.c (rb_thread_save_context, rb_thread_restore_context):
|
||||
|
|
8
array.c
8
array.c
|
@ -1089,12 +1089,12 @@ 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);
|
||||
|
|
Loading…
Reference in a new issue