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

ruby-changes:42761

From: akr <ko1@a...>
Date: Sat, 30 Apr 2016 13:30:17 +0900 (JST)
Subject: [ruby-changes:42761] akr:r54835 (trunk): {Fixnum, Bignum}#modulo is unified into Integer.

akr	2016-04-30 14:26:52 +0900 (Sat, 30 Apr 2016)

  New Revision: 54835

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

  Log:
    {Fixnum,Bignum}#modulo is unified into Integer.
    
    * numeric.c (rb_int_modulo): {Fixnum,Bignum}#modulo is unified into
      Integer.
    
    * bignum.c (rb_big_modulo): Don't define Bignum#modulo.

  Modified files:
    trunk/ChangeLog
    trunk/bignum.c
    trunk/numeric.c
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 54834)
+++ ChangeLog	(revision 54835)
@@ -1,3 +1,10 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Sat Apr 30 14:25:55 2016  Tanaka Akira  <akr@f...>
+
+	* numeric.c (rb_int_modulo): {Fixnum,Bignum}#modulo is unified into
+	  Integer.
+
+	* bignum.c (rb_big_modulo): Don't define Bignum#modulo.
+
 Sat Apr 30 14:04:30 2016  Tanaka Akira  <akr@f...>
 
 	* numeric.c (int_divmod): {Fixnum,Bignum}#divmod is unified into
Index: numeric.c
===================================================================
--- numeric.c	(revision 54834)
+++ numeric.c	(revision 54835)
@@ -3494,7 +3494,7 @@ rb_int_idiv(VALUE x, VALUE y) https://github.com/ruby/ruby/blob/trunk/numeric.c#L3494
 
 /*
  *  Document-method: Fixnum#%
- *  Document-method: Fixnum#modulo
+ *  Document-method: Integer#modulo
  *  call-seq:
  *    fix % other        ->  real
  *    fix.modulo(other)  ->  real
@@ -4841,7 +4841,7 @@ Init_Numeric(void) https://github.com/ruby/ruby/blob/trunk/numeric.c#L4841
     rb_define_method(rb_cFixnum, "/", fix_div, 1);
     rb_define_method(rb_cFixnum, "div", fix_idiv, 1);
     rb_define_method(rb_cFixnum, "%", fix_mod, 1);
-    rb_define_method(rb_cFixnum, "modulo", fix_mod, 1);
+    rb_define_method(rb_cInteger, "modulo", rb_int_modulo, 1);
     rb_define_method(rb_cInteger, "divmod", int_divmod, 1);
     rb_define_method(rb_cInteger, "fdiv", int_fdiv, 1);
     rb_define_method(rb_cInteger, "**", rb_int_pow, 1);
Index: bignum.c
===================================================================
--- bignum.c	(revision 54834)
+++ bignum.c	(revision 54835)
@@ -6126,15 +6126,6 @@ rb_big_idiv(VALUE x, VALUE y) https://github.com/ruby/ruby/blob/trunk/bignum.c#L6126
     return rb_big_divide(x, y, rb_intern("div"));
 }
 
-/*
- *  call-seq:
- *     big % other         -> Numeric
- *     big.modulo(other)   -> Numeric
- *
- *  Returns big modulo other. See Numeric.divmod for more
- *  information.
- */
-
 VALUE
 rb_big_modulo(VALUE x, VALUE y)
 {
@@ -6913,7 +6904,6 @@ Init_Bignum(void) https://github.com/ruby/ruby/blob/trunk/bignum.c#L6904
     rb_define_method(rb_cBignum, "/", rb_big_div, 1);
     rb_define_method(rb_cBignum, "%", rb_big_modulo, 1);
     rb_define_method(rb_cBignum, "div", rb_big_idiv, 1);
-    rb_define_method(rb_cBignum, "modulo", rb_big_modulo, 1);
     rb_define_method(rb_cBignum, "remainder", rb_big_remainder, 1);
 
     rb_define_method(rb_cBignum, "==", rb_big_eq, 1);

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

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