This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[v3] Trim unordered_* includes


Hi,

removes ~250 KB of unused stuff from, e.g., <tr1/unordered_map>. Tested
x86_64-linux without PCHs, committed to mainline.

Paolo.

/////////////
2007-12-24  Paolo Carlini  <pcarlini@suse.de>

	* include/tr1_impl/hashtable_policy.h (_Prime_rehash_policy::
	_M_next_bkt, _M_bkt_for_elements, _M_need_rehash): Use __builtin_ceil.
	* include/std/unordered_map: Do not include <cmath>; prefer
	<bits/stringfwd.h> to <string>.
	* include/std/unordered_set: Likewise.
	* include/tr1/unordered_map: Likewise.
	* include/tr1/unordered_set: Likewise.
Index: include/tr1_impl/hashtable_policy.h
===================================================================
--- include/tr1_impl/hashtable_policy.h	(revision 131155)
+++ include/tr1_impl/hashtable_policy.h	(working copy)
@@ -425,8 +425,8 @@
   {
     const unsigned long* __p = std::lower_bound(__prime_list, __prime_list
 						+ _S_n_primes, __n);
-    _M_next_resize = static_cast<std::size_t>(std::ceil(*__p
-							* _M_max_load_factor));
+    _M_next_resize = 
+      static_cast<std::size_t>(__builtin_ceil(*__p * _M_max_load_factor));
     return *__p;
   }
 
@@ -439,8 +439,8 @@
     const float __min_bkts = __n / _M_max_load_factor;
     const unsigned long* __p = std::lower_bound(__prime_list, __prime_list
 						+ _S_n_primes, __min_bkts);
-    _M_next_resize = static_cast<std::size_t>(std::ceil(*__p
-							* _M_max_load_factor));
+    _M_next_resize =
+      static_cast<std::size_t>(__builtin_ceil(*__p * _M_max_load_factor));
     return *__p;
   }
 
@@ -468,15 +468,14 @@
 	    const unsigned long* __p =
 	      std::lower_bound(__prime_list, __prime_list + _S_n_primes,
 			       __min_bkts);
-	    _M_next_resize =
-	      static_cast<std::size_t>(std::ceil(*__p * _M_max_load_factor));
+	    _M_next_resize = static_cast<std::size_t>
+	      (__builtin_ceil(*__p * _M_max_load_factor));
 	    return std::make_pair(true, *__p);
 	  }
 	else 
 	  {
-	    _M_next_resize =
-	      static_cast<std::size_t>(std::ceil(__n_bkt
-						 * _M_max_load_factor));
+	    _M_next_resize = static_cast<std::size_t>
+	      (__builtin_ceil(__n_bkt * _M_max_load_factor));
 	    return std::make_pair(false, 0);
 	  }
       }
Index: include/std/unordered_map
===================================================================
--- include/std/unordered_map	(revision 131155)
+++ include/std/unordered_map	(working copy)
@@ -44,13 +44,12 @@
 #  error C++0x header cannot be included from TR1 header
 #endif
 
-#include <cmath>
-#include <string>
 #include <utility>
 #include <algorithm> // lower_bound
+#include <type_traits>
 #include <bits/allocator.h>
 #include <bits/stl_function.h> // equal_to, _Identity, _Select1st
-#include <type_traits>
+#include <bits/stringfwd.h>
 #include <bits/functional_hash.h>
 #include <bits/hashtable.h>
 
Index: include/std/unordered_set
===================================================================
--- include/std/unordered_set	(revision 131155)
+++ include/std/unordered_set	(working copy)
@@ -44,13 +44,12 @@
 #  error C++0x header cannot be included from TR1 header
 #endif
 
-#include <cmath>
-#include <string>
 #include <utility>
 #include <algorithm> // lower_bound
+#include <type_traits>
 #include <bits/allocator.h>
 #include <bits/stl_function.h> // equal_to, _Identity, _Select1st
-#include <type_traits>
+#include <bits/stringfwd.h>
 #include <bits/functional_hash.h>
 #include <bits/hashtable.h>
 
Index: include/tr1/unordered_map
===================================================================
--- include/tr1/unordered_map	(revision 131155)
+++ include/tr1/unordered_map	(working copy)
@@ -40,12 +40,11 @@
 #  error TR1 header cannot be included from C++0x header
 #endif
 
-#include <cmath>
-#include <string>
 #include <utility>
 #include <algorithm> // lower_bound
 #include <bits/allocator.h>
 #include <bits/stl_function.h> // equal_to, _Identity, _Select1st
+#include <bits/stringfwd.h>
 #include <tr1/type_traits>
 #include <tr1/functional_hash.h>
 #include <tr1/hashtable.h>
Index: include/tr1/unordered_set
===================================================================
--- include/tr1/unordered_set	(revision 131155)
+++ include/tr1/unordered_set	(working copy)
@@ -40,12 +40,11 @@
 #  error TR1 header cannot be included from C++0x header
 #endif
 
-#include <cmath>
-#include <string>
 #include <utility>
 #include <algorithm> // lower_bound
 #include <bits/allocator.h>
 #include <bits/stl_function.h> // equal_to, _Identity, _Select1st
+#include <bits/stringfwd.h>
 #include <tr1/type_traits>
 #include <tr1/functional_hash.h>
 #include <tr1/hashtable.h>

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]