summaryrefslogtreecommitdiff
path: root/numeric.c
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-04-30 12:55:59 (GMT)
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-04-30 12:55:59 (GMT)
commit6b6fa21031f91757ff9091788a77a3faa29d4a90 (patch)
treedf8bf5782f224061fda10e2c4616128b2356d956 /numeric.c
parent8248c26e6dfb2d80c03c65ca51bca62992e5c959 (diff)
Gather Fixnum method definitions.
* numeric.c (Init_Numeric): Gather Fixnum method definitions. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54852 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'numeric.c')
-rw-r--r--numeric.c30
1 files changed, 16 insertions, 14 deletions
diff --git a/numeric.c b/numeric.c
index 3923b41..15621ce 100644
--- a/numeric.c
+++ b/numeric.c
@@ -4950,19 +4950,12 @@ Init_Numeric(void)
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)
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)
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);