{Fixnum,Bignum}#| is unified into Integer.
* numeric.c (int_or): {Fixnum,Bignum}#| is unified into Integer. * bignum.c (rb_big_or): Don't define Bignum#|. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54825 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
480bcad71d
commit
44af023d44
@ -1,3 +1,10 @@
|
|||||||
|
Sat Apr 30 11:53:48 2016 Tanaka Akira <akr@fsij.org>
|
||||||
|
|
||||||
|
* numeric.c (int_or): {Fixnum,Bignum}#| is unified into
|
||||||
|
Integer.
|
||||||
|
|
||||||
|
* bignum.c (rb_big_or): Don't define Bignum#|.
|
||||||
|
|
||||||
Sat Apr 30 11:18:47 2016 Yuichiro Kaneko <yui-knk@ruby-lang.org>
|
Sat Apr 30 11:18:47 2016 Yuichiro Kaneko <yui-knk@ruby-lang.org>
|
||||||
|
|
||||||
* vm_trace.c: Fix typos. [ci skip]
|
* vm_trace.c: Fix typos. [ci skip]
|
||||||
|
8
bignum.c
8
bignum.c
@ -6556,13 +6556,6 @@ bigor_int(VALUE x, long xn, BDIGIT hibitsx, long y)
|
|||||||
return bignorm(z);
|
return bignorm(z);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* call-seq:
|
|
||||||
* big | numeric -> integer
|
|
||||||
*
|
|
||||||
* Performs bitwise +or+ between _big_ and _numeric_.
|
|
||||||
*/
|
|
||||||
|
|
||||||
VALUE
|
VALUE
|
||||||
rb_big_or(VALUE x, VALUE y)
|
rb_big_or(VALUE x, VALUE y)
|
||||||
{
|
{
|
||||||
@ -6978,7 +6971,6 @@ Init_Bignum(void)
|
|||||||
rb_define_method(rb_cBignum, "fdiv", rb_big_fdiv, 1);
|
rb_define_method(rb_cBignum, "fdiv", rb_big_fdiv, 1);
|
||||||
rb_define_method(rb_cBignum, "**", rb_big_pow, 1);
|
rb_define_method(rb_cBignum, "**", rb_big_pow, 1);
|
||||||
rb_define_method(rb_cBignum, "&", rb_big_and, 1);
|
rb_define_method(rb_cBignum, "&", rb_big_and, 1);
|
||||||
rb_define_method(rb_cBignum, "|", rb_big_or, 1);
|
|
||||||
rb_define_method(rb_cBignum, "~", rb_big_neg, 0);
|
rb_define_method(rb_cBignum, "~", rb_big_neg, 0);
|
||||||
|
|
||||||
rb_define_method(rb_cBignum, "==", rb_big_eq, 1);
|
rb_define_method(rb_cBignum, "==", rb_big_eq, 1);
|
||||||
|
18
numeric.c
18
numeric.c
@ -3913,9 +3913,9 @@ fix_and(VALUE x, VALUE y)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Document-method: Fixnum#|
|
* Document-method: Integer#|
|
||||||
* call-seq:
|
* call-seq:
|
||||||
* fix | integer -> integer_result
|
* integer | integer -> integer_result
|
||||||
*
|
*
|
||||||
* Bitwise OR.
|
* Bitwise OR.
|
||||||
*/
|
*/
|
||||||
@ -3936,6 +3936,18 @@ fix_or(VALUE x, VALUE y)
|
|||||||
return rb_funcall(x, '|', 1, y);
|
return rb_funcall(x, '|', 1, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static VALUE
|
||||||
|
int_or(VALUE x, VALUE y)
|
||||||
|
{
|
||||||
|
if (FIXNUM_P(x)) {
|
||||||
|
return fix_or(x, y);
|
||||||
|
}
|
||||||
|
else if (RB_TYPE_P(x, T_BIGNUM)) {
|
||||||
|
return rb_big_or(x, y);
|
||||||
|
}
|
||||||
|
return Qnil;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Document-method: Integer#^
|
* Document-method: Integer#^
|
||||||
* call-seq:
|
* call-seq:
|
||||||
@ -4769,7 +4781,7 @@ Init_Numeric(void)
|
|||||||
|
|
||||||
rb_define_method(rb_cFixnum, "~", fix_rev, 0);
|
rb_define_method(rb_cFixnum, "~", fix_rev, 0);
|
||||||
rb_define_method(rb_cFixnum, "&", fix_and, 1);
|
rb_define_method(rb_cFixnum, "&", fix_and, 1);
|
||||||
rb_define_method(rb_cFixnum, "|", fix_or, 1);
|
rb_define_method(rb_cInteger, "|", int_or, 1);
|
||||||
rb_define_method(rb_cInteger, "^", int_xor, 1);
|
rb_define_method(rb_cInteger, "^", int_xor, 1);
|
||||||
rb_define_method(rb_cInteger, "[]", int_aref, 1);
|
rb_define_method(rb_cInteger, "[]", int_aref, 1);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user