From b818cdfaf390e0d721bb3e3809280b35fbcf1985 Mon Sep 17 00:00:00 2001 From: matz Date: Mon, 19 Aug 2002 06:41:02 +0000 Subject: [PATCH] * 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 --- ChangeLog | 6 ++++++ array.c | 8 ++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 179ba9320b..48645005ae 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Mon Aug 19 15:38:44 2002 Yukihiro Matsumoto + + * 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 * eval.c (rb_thread_save_context, rb_thread_restore_context): diff --git a/array.c b/array.c index 69bafe643c..5311f2b9d8 100644 --- a/array.c +++ b/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);