diff options
author | paolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-02-28 10:37:04 +0000 |
---|---|---|
committer | paolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-02-28 10:37:04 +0000 |
commit | 13eca00914b5c469b56c7d60b156c8c0bd0e7dee (patch) | |
tree | b17c419af91b17dfba45d9dd76369cb7a2365ff0 /libstdc++-v3 | |
parent | ffcf29bff4329d991ba0fb1fdd191278a6b68107 (diff) | |
download | gcc-13eca00914b5c469b56c7d60b156c8c0bd0e7dee.tar.gz |
2010-02-28 Paolo Carlini <paolo.carlini@oracle.com>
* src/hash-long-double-aux.cc (hash<long double>::
operator()(long double)): Hash both -0 and +0 to 0.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@157120 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3')
-rw-r--r-- | libstdc++-v3/ChangeLog | 5 | ||||
-rw-r--r-- | libstdc++-v3/src/hash-long-double-aux.cc | 8 |
2 files changed, 9 insertions, 4 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 564f905cbe0..ef97ea3c0cf 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,8 @@ +2010-02-28 Paolo Carlini <paolo.carlini@oracle.com> + + * src/hash-long-double-aux.cc (hash<long double>:: + operator()(long double)): Hash both -0 and +0 to 0. + 2010-02-25 Ed Smith-Rowland <3dw4rd@verizon.net> * include/bits/random.tcc (operator<<): Use max_digits10. diff --git a/libstdc++-v3/src/hash-long-double-aux.cc b/libstdc++-v3/src/hash-long-double-aux.cc index 5b8bbfdd49d..d54d635f83e 100644 --- a/libstdc++-v3/src/hash-long-double-aux.cc +++ b/libstdc++-v3/src/hash-long-double-aux.cc @@ -28,7 +28,9 @@ size_t hash<long double>::operator()(long double __val) const { - size_t __result = 0; + // 0 and -0 both hash to zero. + if (__val == 0.0L) + return 0; int __exponent; __val = __builtin_frexpl(__val, &__exponent); @@ -44,7 +46,5 @@ const size_t __coeff = __SIZE_MAX__ / __LDBL_MAX_EXP__; - __result = __hibits + (size_t)__val + __coeff * __exponent; - - return __result; + return __hibits + (size_t)__val + __coeff * __exponent; } |