mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* bignum.c (rb_big_hash): make it public function to be available in
other source files, and remove documentation comment for Bignum#hash. * bignum.c (Bignum#hash): remove its definition because it is unified with Object#hash. * include/ruby/intern.h (rb_big_hash): add a prototype declaration. * hash.c (any_hash): treat Bignum values directly. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54168 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
1ba62fa93a
commit
f8e79c84a9
4 changed files with 18 additions and 11 deletions
12
ChangeLog
12
ChangeLog
|
@ -1,3 +1,15 @@
|
||||||
|
Fri Mar 18 10:17:00 2016 Kenta Murata <mrkn@mrkn.jp>
|
||||||
|
|
||||||
|
* bignum.c (rb_big_hash): make it public function to be available in
|
||||||
|
other source files, and remove documentation comment for Bignum#hash.
|
||||||
|
|
||||||
|
* bignum.c (Bignum#hash): remove its definition because it is unified
|
||||||
|
with Object#hash.
|
||||||
|
|
||||||
|
* include/ruby/intern.h (rb_big_hash): add a prototype declaration.
|
||||||
|
|
||||||
|
* hash.c (any_hash): treat Bignum values directly.
|
||||||
|
|
||||||
Fri Mar 18 02:35:12 2016 Naotoshi Seo <sonots@gmail.com>
|
Fri Mar 18 02:35:12 2016 Naotoshi Seo <sonots@gmail.com>
|
||||||
|
|
||||||
* lib/time.rb (parse, strptime): Fix Time.parse/strptime does not
|
* lib/time.rb (parse, strptime): Fix Time.parse/strptime does not
|
||||||
|
|
12
bignum.c
12
bignum.c
|
@ -6837,16 +6837,7 @@ rb_big_aref(VALUE x, VALUE y)
|
||||||
return (xds[s1] & bit) ? INT2FIX(1) : INT2FIX(0);
|
return (xds[s1] & bit) ? INT2FIX(1) : INT2FIX(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
VALUE
|
||||||
* call-seq:
|
|
||||||
* big.hash -> fixnum
|
|
||||||
*
|
|
||||||
* Compute a hash based on the value of _big_.
|
|
||||||
*
|
|
||||||
* See also Object#hash.
|
|
||||||
*/
|
|
||||||
|
|
||||||
static VALUE
|
|
||||||
rb_big_hash(VALUE x)
|
rb_big_hash(VALUE x)
|
||||||
{
|
{
|
||||||
st_index_t hash;
|
st_index_t hash;
|
||||||
|
@ -7085,7 +7076,6 @@ Init_Bignum(void)
|
||||||
rb_define_method(rb_cBignum, "<=", big_le, 1);
|
rb_define_method(rb_cBignum, "<=", big_le, 1);
|
||||||
rb_define_method(rb_cBignum, "===", rb_big_eq, 1);
|
rb_define_method(rb_cBignum, "===", rb_big_eq, 1);
|
||||||
rb_define_method(rb_cBignum, "eql?", rb_big_eql, 1);
|
rb_define_method(rb_cBignum, "eql?", rb_big_eql, 1);
|
||||||
rb_define_method(rb_cBignum, "hash", rb_big_hash, 0);
|
|
||||||
rb_define_method(rb_cBignum, "to_f", rb_big_to_f, 0);
|
rb_define_method(rb_cBignum, "to_f", rb_big_to_f, 0);
|
||||||
rb_define_method(rb_cBignum, "abs", rb_big_abs, 0);
|
rb_define_method(rb_cBignum, "abs", rb_big_abs, 0);
|
||||||
rb_define_method(rb_cBignum, "magnitude", rb_big_abs, 0);
|
rb_define_method(rb_cBignum, "magnitude", rb_big_abs, 0);
|
||||||
|
|
4
hash.c
4
hash.c
|
@ -169,6 +169,10 @@ any_hash(VALUE a, st_index_t (*other_func)(VALUE))
|
||||||
else if (BUILTIN_TYPE(a) == T_SYMBOL) {
|
else if (BUILTIN_TYPE(a) == T_SYMBOL) {
|
||||||
hnum = RSYMBOL(a)->hashval;
|
hnum = RSYMBOL(a)->hashval;
|
||||||
}
|
}
|
||||||
|
else if (BUILTIN_TYPE(a) == T_BIGNUM) {
|
||||||
|
hval = rb_big_hash(a);
|
||||||
|
hnum = FIX2LONG(hval);
|
||||||
|
}
|
||||||
else if (BUILTIN_TYPE(a) == T_FLOAT) {
|
else if (BUILTIN_TYPE(a) == T_FLOAT) {
|
||||||
flt:
|
flt:
|
||||||
hval = rb_dbl_hash(rb_float_value(a));
|
hval = rb_dbl_hash(rb_float_value(a));
|
||||||
|
|
|
@ -133,6 +133,7 @@ VALUE rb_big_lshift(VALUE, VALUE);
|
||||||
VALUE rb_big_rshift(VALUE, VALUE);
|
VALUE rb_big_rshift(VALUE, VALUE);
|
||||||
VALUE rb_big_odd_p(VALUE);
|
VALUE rb_big_odd_p(VALUE);
|
||||||
VALUE rb_big_even_p(VALUE);
|
VALUE rb_big_even_p(VALUE);
|
||||||
|
VALUE rb_big_hash(VALUE);
|
||||||
|
|
||||||
/* For rb_integer_pack and rb_integer_unpack: */
|
/* For rb_integer_pack and rb_integer_unpack: */
|
||||||
/* "MS" in MSWORD and MSBYTE means "most significant" */
|
/* "MS" in MSWORD and MSBYTE means "most significant" */
|
||||||
|
|
Loading…
Add table
Reference in a new issue