* 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>.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@130312
138bc75d-0d04-0410-961f-
82ee72b054a4
+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.
_ZNKSt3tr14hashIRKSsEclES2_;
_ZNKSt3tr14hashISbIwSt11char_traitsIwESaIwEEEclES4_;
_ZNKSt3tr14hashISsEclESs;
+ _ZNKSt3tr14hashIeEclEe;
_ZNKSt4hashIRKSbIwSt11char_traitsIwESaIwEEEclES5_;
_ZNKSt4hashIRKSsEclES1_;
_ZNKSt4hashISbIwSt11char_traitsIwESaIwEEEclES3_;
_ZNKSt4hashISsEclESs;
_ZNKSt4hashISt10error_codeEclES0_;
+ _ZNKSt4hashIeEclEe;
# for parallel mode
_ZNSt9__cxx199815_List_node_base4hook*;
# 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>
#include <bits/c++config.h>
#include <bits/stl_function.h>
-#include <cmath>
#include <typeinfo>
#include <new>
#include <tr1/tuple>
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<>
#include <cstddef>
#include <string>
+#include <cmath>
#ifdef __GXX_EXPERIMENTAL_CXX0X__
#include <functional>
{
_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