[前][次][番号順一覧][スレッド一覧]

ruby-changes:42119

From: naruse <ko1@a...>
Date: Sat, 19 Mar 2016 19:07:03 +0900 (JST)
Subject: [ruby-changes:42119] naruse:r54193 (trunk): * numeric.c (fix_cmp): use rb_big_cmp if x is Fixnum and y is Bignum.

naruse	2016-03-19 19:06:57 +0900 (Sat, 19 Mar 2016)

  New Revision: 54193

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=54193

  Log:
    * numeric.c (fix_cmp): use rb_big_cmp if x is Fixnum and y is Bignum.
      rb_big_cmp handles such case smartly with big_norm.

  Modified files:
    trunk/numeric.c
Index: numeric.c
===================================================================
--- numeric.c	(revision 54192)
+++ numeric.c	(revision 54193)
@@ -3425,7 +3425,7 @@ fix_cmp(VALUE x, VALUE y) https://github.com/ruby/ruby/blob/trunk/numeric.c#L3425
 	return INT2FIX(-1);
     }
     else if (RB_TYPE_P(y, T_BIGNUM)) {
-	return rb_big_cmp(rb_int2big(FIX2LONG(x)), y);
+	return rb_big_cmp(y, x);
     }
     else if (RB_TYPE_P(y, T_FLOAT)) {
 	return rb_integer_float_cmp(x, y);

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]