diff options
author | Paolo Carlini <paolo.carlini@oracle.com> | 2010-02-28 10:37:04 +0000 |
---|---|---|
committer | Paolo Carlini <paolo@gcc.gnu.org> | 2010-02-28 10:37:04 +0000 |
commit | bea9840ef1a9e0c7b7c33a4950088c732befa563 (patch) | |
tree | b17c419af91b17dfba45d9dd76369cb7a2365ff0 /libstdc++-v3/src | |
parent | 91ad7e13d14ce8e5f855cc6c93ce5901ea8ec7fc (diff) | |
download | gcc-bea9840ef1a9e0c7b7c33a4950088c732befa563.zip gcc-bea9840ef1a9e0c7b7c33a4950088c732befa563.tar.gz gcc-bea9840ef1a9e0c7b7c33a4950088c732befa563.tar.bz2 |
hash-long-double-aux.cc (hash<long double>:: operator()(long double)): Hash both -0 and +0 to 0.
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.
From-SVN: r157120
Diffstat (limited to 'libstdc++-v3/src')
-rw-r--r-- | libstdc++-v3/src/hash-long-double-aux.cc | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/libstdc++-v3/src/hash-long-double-aux.cc b/libstdc++-v3/src/hash-long-double-aux.cc index 5b8bbfd..d54d635 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; } |