aboutsummaryrefslogtreecommitdiffstats
path: root/numeric.c
diff options
context:
space:
mode:
Diffstat (limited to 'numeric.c')
-rw-r--r--numeric.c34
1 files changed, 4 insertions, 30 deletions
diff --git a/numeric.c b/numeric.c
index d599e123f5..e4bb4817bb 100644
--- a/numeric.c
+++ b/numeric.c
@@ -3456,15 +3456,6 @@ int_chr(int argc, VALUE *argv, VALUE num)
* Fixnum
*/
-
-/*
- * Document-method: Integer#-@
- * call-seq:
- * -int -> integer
- *
- * Returns +int+, negated.
- */
-
static VALUE
fix_uminus(VALUE num)
{
@@ -3477,10 +3468,10 @@ rb_int_uminus(VALUE num)
if (FIXNUM_P(num)) {
return fix_uminus(num);
}
- else if (RB_TYPE_P(num, T_BIGNUM)) {
+ else {
+ assert(RB_TYPE_P(num, T_BIGNUM));
return rb_big_uminus(num);
}
- return num_funcall0(num, idUMinus);
}
/*
@@ -4371,29 +4362,14 @@ int_le(VALUE x, VALUE y)
return Qnil;
}
-/*
- * Document-method: Integer#~
- * call-seq:
- * ~int -> integer
- *
- * One's complement: returns a number where each bit is flipped.
- *
- * Inverts the bits in an Integer. As integers are conceptually of
- * infinite length, the result acts as if it had an infinite number of
- * one bits to the left. In hex representations, this is displayed
- * as two periods to the left of the digits.
- *
- * sprintf("%X", ~0x1122334455) #=> "..FEEDDCCBBAA"
- */
-
static VALUE
fix_comp(VALUE num)
{
return ~num | FIXNUM_FLAG;
}
-static VALUE
-int_comp(VALUE num)
+VALUE
+rb_int_comp(VALUE num)
{
if (FIXNUM_P(num)) {
return fix_comp(num);
@@ -5576,7 +5552,6 @@ Init_Numeric(void)
rb_define_method(rb_cInteger, "round", int_round, -1);
rb_define_method(rb_cInteger, "<=>", rb_int_cmp, 1);
- rb_define_method(rb_cInteger, "-@", rb_int_uminus, 0);
rb_define_method(rb_cInteger, "+", rb_int_plus, 1);
rb_define_method(rb_cInteger, "-", rb_int_minus, 1);
rb_define_method(rb_cInteger, "*", rb_int_mul, 1);
@@ -5598,7 +5573,6 @@ Init_Numeric(void)
rb_define_method(rb_cInteger, "<", int_lt, 1);
rb_define_method(rb_cInteger, "<=", int_le, 1);
- rb_define_method(rb_cInteger, "~", int_comp, 0);
rb_define_method(rb_cInteger, "&", rb_int_and, 1);
rb_define_method(rb_cInteger, "|", int_or, 1);
rb_define_method(rb_cInteger, "^", int_xor, 1);