OSDN Git Service

2007-11-20 Paolo Carlini <pcarlini@suse.de>
authorpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 20 Nov 2007 12:34:44 +0000 (12:34 +0000)
committerpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 20 Nov 2007 12:34:44 +0000 (12:34 +0000)
* 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

libstdc++-v3/ChangeLog
libstdc++-v3/config/abi/pre/gnu.ver
libstdc++-v3/include/std/functional
libstdc++-v3/include/tr1/functional
libstdc++-v3/include/tr1_impl/functional_hash.h
libstdc++-v3/src/hash.cc

index 0b65380..4de61c7 100644 (file)
@@ -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.
index 0983e93..3a5bcb5 100644 (file)
@@ -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*;
index 83bf85a..6b0ca04 100644 (file)
@@ -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>
index 190f61a..fa3dc65 100644 (file)
@@ -43,7 +43,6 @@
 #include <bits/c++config.h>
 #include <bits/stl_function.h>
 
-#include <cmath>
 #include <typeinfo>
 #include <new>
 #include <tr1/tuple>
index 2ac1a45..0dfff38 100644 (file)
@@ -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<>
index 60554dd..c2b3b05 100644 (file)
@@ -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