aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.6/libstdc++-v3/src/hash_c++0x.cc
diff options
context:
space:
mode:
authorJing Yu <jingyu@google.com>2012-02-15 15:40:16 -0800
committerJing Yu <jingyu@google.com>2012-02-15 15:40:16 -0800
commit3f73d6ef90458b45bbbb33ef4c2b174d4662a22d (patch)
tree1b5f0d96c51b51168b3713058a1b62e92f1136eb /gcc-4.6/libstdc++-v3/src/hash_c++0x.cc
parentd7030123e04baab5dbff9c9ee04c0de99bd9a774 (diff)
downloadtoolchain_gcc-3f73d6ef90458b45bbbb33ef4c2b174d4662a22d.tar.gz
toolchain_gcc-3f73d6ef90458b45bbbb33ef4c2b174d4662a22d.tar.bz2
toolchain_gcc-3f73d6ef90458b45bbbb33ef4c2b174d4662a22d.zip
Sync down FSF r184235@google/gcc-4_6_2-mobile branch
1) Get mostly new patches from FSF gcc-4.6 branch 2) Fix PR52129 3) Insert GNU-stack note for all ARM targets Change-Id: I2b9926981210e517e4021242908074319a91d6bd
Diffstat (limited to 'gcc-4.6/libstdc++-v3/src/hash_c++0x.cc')
-rw-r--r--gcc-4.6/libstdc++-v3/src/hash_c++0x.cc26
1 files changed, 24 insertions, 2 deletions
diff --git a/gcc-4.6/libstdc++-v3/src/hash_c++0x.cc b/gcc-4.6/libstdc++-v3/src/hash_c++0x.cc
index 852498df6..d68507454 100644
--- a/gcc-4.6/libstdc++-v3/src/hash_c++0x.cc
+++ b/gcc-4.6/libstdc++-v3/src/hash_c++0x.cc
@@ -1,6 +1,6 @@
// std::hash definitions -*- C++ -*-
-// Copyright (C) 2010 Free Software Foundation, Inc.
+// Copyright (C) 2010, 2011 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -30,5 +30,27 @@
namespace std _GLIBCXX_VISIBILITY(default)
{
-#include "hash-long-double-aux.cc"
+ _GLIBCXX_PURE size_t
+ hash<long double>::operator()(long double __val) const noexcept
+ {
+ // 0 and -0 both hash to zero.
+ if (__val == 0.0L)
+ return 0;
+
+ int __exponent;
+ __val = __builtin_frexpl(__val, &__exponent);
+ __val = __val < 0.0l ? -(__val + 0.5l) : __val;
+
+ const long double __mult = __SIZE_MAX__ + 1.0l;
+ __val *= __mult;
+
+ // Try to use all the bits of the mantissa (really necessary only
+ // on 32-bit targets, at least for 80-bit floating point formats).
+ const size_t __hibits = (size_t)__val;
+ __val = (__val - (long double)__hibits) * __mult;
+
+ const size_t __coeff = __SIZE_MAX__ / __LDBL_MAX_EXP__;
+
+ return __hibits + (size_t)__val + __coeff * __exponent;
+ }
}