summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libstdc++-v3/ChangeLog11
-rw-r--r--libstdc++-v3/config/abi/pre/gnu.ver2
-rw-r--r--libstdc++-v3/include/std/functional2
-rw-r--r--libstdc++-v3/include/tr1/functional1
-rw-r--r--libstdc++-v3/include/tr1_impl/functional_hash.h29
-rw-r--r--libstdc++-v3/src/hash.cc30
6 files changed, 46 insertions, 29 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 0b653805253..4de61c71670 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,14 @@
+2007-11-20 Paolo Carlini <pcarlini@suse.de>
+
+ * include/tr1_impl/functional_hash.h
+ (hash<long double>::operator()(long double)): Only declare.
+ * src/hash.cc: Define here.
+ * config/abi/pre/gnu.ver: Adjust exports.
+ * include/tr1/functional: Do not include <cmath>.
+ * include/std/functional: Likewise.
+
+ * include/std/functional: Include <new>.
+
2007-11-18 Paolo Carlini <pcarlini@suse.de>
* include/tr1/type_traits (_DEFINE_SPEC_BODY): Remove.
diff --git a/libstdc++-v3/config/abi/pre/gnu.ver b/libstdc++-v3/config/abi/pre/gnu.ver
index 0983e93e686..3a5bcb5e244 100644
--- a/libstdc++-v3/config/abi/pre/gnu.ver
+++ b/libstdc++-v3/config/abi/pre/gnu.ver
@@ -770,12 +770,14 @@ GLIBCXX_3.4.10 {
_ZNKSt3tr14hashIRKSsEclES2_;
_ZNKSt3tr14hashISbIwSt11char_traitsIwESaIwEEEclES4_;
_ZNKSt3tr14hashISsEclESs;
+ _ZNKSt3tr14hashIeEclEe;
_ZNKSt4hashIRKSbIwSt11char_traitsIwESaIwEEEclES5_;
_ZNKSt4hashIRKSsEclES1_;
_ZNKSt4hashISbIwSt11char_traitsIwESaIwEEEclES3_;
_ZNKSt4hashISsEclESs;
_ZNKSt4hashISt10error_codeEclES0_;
+ _ZNKSt4hashIeEclEe;
# for parallel mode
_ZNSt9__cxx199815_List_node_base4hook*;
diff --git a/libstdc++-v3/include/std/functional b/libstdc++-v3/include/std/functional
index 83bf85aef29..6b0ca04bece 100644
--- a/libstdc++-v3/include/std/functional
+++ b/libstdc++-v3/include/std/functional
@@ -58,8 +58,8 @@
# if defined(_GLIBCXX_INCLUDE_AS_TR1)
# error C++0x header cannot be included from TR1 header
# endif
-# include <cmath>
# include <typeinfo>
+# include <new>
# include <tuple>
# include <type_traits>
# include <bits/stringfwd.h>
diff --git a/libstdc++-v3/include/tr1/functional b/libstdc++-v3/include/tr1/functional
index 190f61ae66b..fa3dc6537c2 100644
--- a/libstdc++-v3/include/tr1/functional
+++ b/libstdc++-v3/include/tr1/functional
@@ -43,7 +43,6 @@
#include <bits/c++config.h>
#include <bits/stl_function.h>
-#include <cmath>
#include <typeinfo>
#include <new>
#include <tr1/tuple>
diff --git a/libstdc++-v3/include/tr1_impl/functional_hash.h b/libstdc++-v3/include/tr1_impl/functional_hash.h
index 2ac1a45f6ba..0dfff38e7b9 100644
--- a/libstdc++-v3/include/tr1_impl/functional_hash.h
+++ b/libstdc++-v3/include/tr1_impl/functional_hash.h
@@ -155,34 +155,9 @@ _GLIBCXX_BEGIN_NAMESPACE_TR1
return __result;
};
- // For long double, careful with random padding bits (e.g., on x86,
- // 10 bytes -> 12 bytes) and resort to frexp.
template<>
- inline size_t
- hash<long double>::operator()(long double __val) const
- {
- size_t __result = 0;
-
- int __exponent;
- __val = std::frexp(__val, &__exponent);
- __val = __val < 0.0l ? -(__val + 0.5l) : __val;
-
- const long double __mult =
- __gnu_cxx::__numeric_traits<size_t>::__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 =
- __gnu_cxx::__numeric_traits<size_t>::__max / __LDBL_MAX_EXP__;
-
- __result = __hibits + (size_t)__val + __coeff * __exponent;
-
- return __result;
- };
+ size_t
+ hash<long double>::operator()(long double __val) const;
// Explicit specialization of member operator for types that are not builtin.
template<>
diff --git a/libstdc++-v3/src/hash.cc b/libstdc++-v3/src/hash.cc
index 60554dd2a92..c2b3b0508ca 100644
--- a/libstdc++-v3/src/hash.cc
+++ b/libstdc++-v3/src/hash.cc
@@ -29,6 +29,7 @@
#include <cstddef>
#include <string>
+#include <cmath>
#ifdef __GXX_EXPERIMENTAL_CXX0X__
#include <functional>
@@ -45,6 +46,35 @@ namespace std
{
_GLIBCXX_BEGIN_NAMESPACE_TR1
+ // For long double, careful with random padding bits (e.g., on x86,
+ // 10 bytes -> 12 bytes) and resort to frexp.
+ template<>
+ size_t
+ hash<long double>::operator()(long double __val) const
+ {
+ size_t __result = 0;
+
+ int __exponent;
+ __val = std::frexp(__val, &__exponent);
+ __val = __val < 0.0l ? -(__val + 0.5l) : __val;
+
+ const long double __mult =
+ __gnu_cxx::__numeric_traits<size_t>::__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 =
+ __gnu_cxx::__numeric_traits<size_t>::__max / __LDBL_MAX_EXP__;
+
+ __result = __hibits + (size_t)__val + __coeff * __exponent;
+
+ return __result;
+ };
+
template<>
size_t
hash<string>::operator()(string __s) const