* internal.h (ST2FIX): new macro to convert st_index_t to Fixnum.

a hash value of Object might be Bignum, but it causes many troubles
  expecially the Object is used as a key of a hash.  so I've gave up
  to do so.

* array.c (rb_ary_hash): use above macro.

* bignum.c (rb_big_hash): ditto.

* hash.c (rb_obj_hash, rb_hash_hash): ditto.

* numeric.c (rb_dbl_hash): ditto.

* proc.c (proc_hash): ditto.

* re.c (rb_reg_hash, match_hash): ditto.

* string.c (rb_str_hash_m): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56340 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
usa 2016-10-04 16:25:01 +00:00
parent 30e856f589
commit c2dd2d268e
9 changed files with 33 additions and 15 deletions

4
re.c
View file

@ -2888,7 +2888,7 @@ static VALUE
rb_reg_hash(VALUE re)
{
st_index_t hashval = reg_hash(re);
return LONG2FIX(hashval);
return ST2FIX(hashval);
}
static st_index_t
@ -2956,7 +2956,7 @@ match_hash(VALUE match)
hashval = rb_hash_uint(hashval, rb_memhash(regs->beg, regs->num_regs * sizeof(*regs->beg)));
hashval = rb_hash_uint(hashval, rb_memhash(regs->end, regs->num_regs * sizeof(*regs->end)));
hashval = rb_hash_end(hashval);
return LONG2FIX(hashval);
return ST2FIX(hashval);
}
/*