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

ruby-changes:42778

From: akr <ko1@a...>
Date: Sat, 30 Apr 2016 20:59:22 +0900 (JST)
Subject: [ruby-changes:42778] akr:r54852 (trunk): Gather Fixnum method definitions.

akr	2016-04-30 21:55:59 +0900 (Sat, 30 Apr 2016)

  New Revision: 54852

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

  Log:
    Gather Fixnum method definitions.
    
    * numeric.c (Init_Numeric): Gather Fixnum method definitions.

  Modified files:
    trunk/ChangeLog
    trunk/numeric.c
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 54851)
+++ ChangeLog	(revision 54852)
@@ -1,3 +1,7 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Sat Apr 30 21:54:13 2016  Tanaka Akira  <akr@f...>
+
+	* numeric.c (Init_Numeric): Gather Fixnum method definitions.
+
 Sat Apr 30 21:28:14 2016  Tanaka Akira  <akr@f...>
 
 	* numeric.c (rb_int_div): Define Integer#/.
Index: numeric.c
===================================================================
--- numeric.c	(revision 54851)
+++ numeric.c	(revision 54852)
@@ -4950,19 +4950,12 @@ Init_Numeric(void) https://github.com/ruby/ruby/blob/trunk/numeric.c#L4950
     rb_define_method(rb_cInteger, "round", int_round, -1);
     rb_define_method(rb_cInteger, "<=>", int_cmp, 1);
 
-    rb_cFixnum = rb_define_class("Fixnum", rb_cInteger);
-
     rb_define_method(rb_cInteger, "-@", rb_int_uminus, 0);
-    rb_define_method(rb_cFixnum, "+", fix_plus, 1);
     rb_define_method(rb_cInteger, "+", rb_int_plus, 1);
-    rb_define_method(rb_cFixnum, "-", fix_minus, 1);
     rb_define_method(rb_cInteger, "-", rb_int_minus, 1);
-    rb_define_method(rb_cFixnum, "*", fix_mul, 1);
     rb_define_method(rb_cInteger, "*", rb_int_mul, 1);
-    rb_define_method(rb_cFixnum, "/", fix_div, 1);
     rb_define_method(rb_cInteger, "/", rb_int_div, 1);
     rb_define_method(rb_cInteger, "div", rb_int_idiv, 1);
-    rb_define_method(rb_cFixnum, "%", fix_mod, 1);
     rb_define_method(rb_cInteger, "%", rb_int_modulo, 1);
     rb_define_method(rb_cInteger, "modulo", rb_int_modulo, 1);
     rb_define_method(rb_cInteger, "remainder", int_remainder, 1);
@@ -4979,13 +4972,6 @@ Init_Numeric(void) https://github.com/ruby/ruby/blob/trunk/numeric.c#L4972
     rb_define_method(rb_cInteger, "<", int_lt, 1);
     rb_define_method(rb_cInteger, "<=", int_le, 1);
 
-    rb_define_method(rb_cFixnum, "==", fix_equal, 1);
-    rb_define_method(rb_cFixnum, "===", fix_equal, 1);
-    rb_define_method(rb_cFixnum, ">",  fix_gt, 1);
-    rb_define_method(rb_cFixnum, ">=", fix_ge, 1);
-    rb_define_method(rb_cFixnum, "<",  fix_lt, 1);
-    rb_define_method(rb_cFixnum, "<=", fix_le, 1);
-
     rb_define_method(rb_cInteger, "~", int_comp, 0);
     rb_define_method(rb_cInteger, "&", int_and, 1);
     rb_define_method(rb_cInteger, "|", int_or,  1);
@@ -4997,6 +4983,22 @@ Init_Numeric(void) https://github.com/ruby/ruby/blob/trunk/numeric.c#L4983
 
     rb_define_method(rb_cInteger, "size", int_size, 0);
     rb_define_method(rb_cInteger, "bit_length", rb_int_bit_length, 0);
+
+    rb_cFixnum = rb_define_class("Fixnum", rb_cInteger);
+
+    rb_define_method(rb_cFixnum, "+", fix_plus, 1);
+    rb_define_method(rb_cFixnum, "-", fix_minus, 1);
+    rb_define_method(rb_cFixnum, "*", fix_mul, 1);
+    rb_define_method(rb_cFixnum, "/", fix_div, 1);
+    rb_define_method(rb_cFixnum, "%", fix_mod, 1);
+
+    rb_define_method(rb_cFixnum, "==", fix_equal, 1);
+    rb_define_method(rb_cFixnum, "===", fix_equal, 1);
+    rb_define_method(rb_cFixnum, ">",  fix_gt, 1);
+    rb_define_method(rb_cFixnum, ">=", fix_ge, 1);
+    rb_define_method(rb_cFixnum, "<",  fix_lt, 1);
+    rb_define_method(rb_cFixnum, "<=", fix_le, 1);
+
     rb_define_method(rb_cFixnum, "succ", fix_succ, 0);
 
     rb_cFloat  = rb_define_class("Float", rb_cNumeric);

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

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