mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* ext/bigdecimal/bigdecimal.c (BigDecimal_hash): use rb_memhash and take care of negative finite numbers properly.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28825 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
c29b801afa
commit
98685cc70f
2 changed files with 8 additions and 6 deletions
|
@ -1,3 +1,8 @@
|
|||
Sun Aug 1 22:16:30 2010 Kenta Murata <mrkn@mrkn.jp>
|
||||
|
||||
* ext/bigdecimal/bigdecimal.c (BigDecimal_hash): use rb_memhash and
|
||||
take care of negative finite numbers properly.
|
||||
|
||||
Sun Aug 1 20:57:22 2010 Tanaka Akira <akr@fsij.org>
|
||||
|
||||
* ext/pathname/pathname.c (path_realpath): Pathname#realpath translated
|
||||
|
|
|
@ -228,12 +228,9 @@ BigDecimal_hash(VALUE self)
|
|||
GUARD_OBJ(p,GetVpValue(self,1));
|
||||
hash = (U_LONG)p->sign;
|
||||
/* hash!=2: the case for 0(1),NaN(0) or +-Infinity(3) is sign itself */
|
||||
if(hash==2) {
|
||||
for(i = 0; i < p->Prec;i++) {
|
||||
hash = 31 * hash + p->frac[i];
|
||||
hash ^= p->frac[i];
|
||||
}
|
||||
hash += p->exponent;
|
||||
if(hash == 2 || hash == -2) {
|
||||
hash ^= rb_memhash(p->frac, sizeof(U_LONG)*p->Prec);
|
||||
hash += p->exponent;
|
||||
}
|
||||
return INT2FIX(hash);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue