Skip to content

Commit 9368674

Browse files
committed
[libc++] Remove a few includes from <__hash_table>
1 parent 0f0cfcf commit 9368674

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

libcxx/include/__hash_table

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#include <__functional/hash.h>
1919
#include <__functional/invoke.h>
2020
#include <__iterator/iterator_traits.h>
21+
#include <__math/rounding_functions.h>
2122
#include <__memory/addressof.h>
2223
#include <__memory/allocator_traits.h>
2324
#include <__memory/compressed_pair.h>
@@ -40,9 +41,7 @@
4041
#include <__utility/move.h>
4142
#include <__utility/pair.h>
4243
#include <__utility/swap.h>
43-
#include <cmath>
4444
#include <cstring>
45-
#include <initializer_list>
4645
#include <new> // __launder
4746

4847
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
@@ -875,10 +874,10 @@ public:
875874
_LIBCPP_HIDE_FROM_ABI void __rehash_unique(size_type __n) { __rehash<true>(__n); }
876875
_LIBCPP_HIDE_FROM_ABI void __rehash_multi(size_type __n) { __rehash<false>(__n); }
877876
_LIBCPP_HIDE_FROM_ABI void __reserve_unique(size_type __n) {
878-
__rehash_unique(static_cast<size_type>(std::ceil(__n / max_load_factor())));
877+
__rehash_unique(static_cast<size_type>(__math::ceil(__n / max_load_factor())));
879878
}
880879
_LIBCPP_HIDE_FROM_ABI void __reserve_multi(size_type __n) {
881-
__rehash_multi(static_cast<size_type>(std::ceil(__n / max_load_factor())));
880+
__rehash_multi(static_cast<size_type>(__math::ceil(__n / max_load_factor())));
882881
}
883882

884883
_LIBCPP_HIDE_FROM_ABI size_type bucket_count() const _NOEXCEPT { return __bucket_list_.get_deleter().size(); }
@@ -1348,7 +1347,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_insert_unique_prepare(size_t __
13481347
}
13491348
if (size() + 1 > __bc * max_load_factor() || __bc == 0) {
13501349
__rehash_unique(std::max<size_type>(
1351-
2 * __bc + !std::__is_hash_power2(__bc), size_type(std::ceil(float(size() + 1) / max_load_factor()))));
1350+
2 * __bc + !std::__is_hash_power2(__bc), size_type(__math::ceil(float(size() + 1) / max_load_factor()))));
13521351
}
13531352
return nullptr;
13541353
}
@@ -1408,7 +1407,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_insert_multi_prepare(size_t __c
14081407
size_type __bc = bucket_count();
14091408
if (size() + 1 > __bc * max_load_factor() || __bc == 0) {
14101409
__rehash_multi(std::max<size_type>(
1411-
2 * __bc + !std::__is_hash_power2(__bc), size_type(std::ceil(float(size() + 1) / max_load_factor()))));
1410+
2 * __bc + !std::__is_hash_power2(__bc), size_type(__math::ceil(float(size() + 1) / max_load_factor()))));
14121411
__bc = bucket_count();
14131412
}
14141413
size_t __chash = std::__constrain_hash(__cp_hash, __bc);
@@ -1483,7 +1482,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_insert_multi(const_iterator __p
14831482
size_type __bc = bucket_count();
14841483
if (size() + 1 > __bc * max_load_factor() || __bc == 0) {
14851484
__rehash_multi(std::max<size_type>(
1486-
2 * __bc + !std::__is_hash_power2(__bc), size_type(std::ceil(float(size() + 1) / max_load_factor()))));
1485+
2 * __bc + !std::__is_hash_power2(__bc), size_type(__math::ceil(float(size() + 1) / max_load_factor()))));
14871486
__bc = bucket_count();
14881487
}
14891488
size_t __chash = std::__constrain_hash(__cp->__hash_, __bc);
@@ -1523,7 +1522,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__emplace_unique_key_args(_Key const&
15231522
__node_holder __h = __construct_node_hash(__hash, std::forward<_Args>(__args)...);
15241523
if (size() + 1 > __bc * max_load_factor() || __bc == 0) {
15251524
__rehash_unique(std::max<size_type>(
1526-
2 * __bc + !std::__is_hash_power2(__bc), size_type(std::ceil(float(size() + 1) / max_load_factor()))));
1525+
2 * __bc + !std::__is_hash_power2(__bc), size_type(__math::ceil(float(size() + 1) / max_load_factor()))));
15271526
__bc = bucket_count();
15281527
__chash = std::__constrain_hash(__hash, __bc);
15291528
}
@@ -1692,8 +1691,8 @@ void __hash_table<_Tp, _Hash, _Equal, _Alloc>::__rehash(size_type __n) _LIBCPP_D
16921691
else if (__n < __bc) {
16931692
__n = std::max<size_type>(
16941693
__n,
1695-
std::__is_hash_power2(__bc) ? std::__next_hash_pow2(size_t(std::ceil(float(size()) / max_load_factor())))
1696-
: std::__next_prime(size_t(std::ceil(float(size()) / max_load_factor()))));
1694+
std::__is_hash_power2(__bc) ? std::__next_hash_pow2(size_t(__math::ceil(float(size()) / max_load_factor())))
1695+
: std::__next_prime(size_t(__math::ceil(float(size()) / max_load_factor()))));
16971696
if (__n < __bc)
16981697
__do_rehash<_UniqueKeys>(__n);
16991698
}

0 commit comments

Comments
 (0)