Revert "Revert "Merge to upstream r304942.""
This reverts commit 38a0d5af7e.
Test: make checkbuild
Test: ./run_tests.py
Test: ./run_tests.py --bitness 64
This commit is contained in:
@@ -20,17 +20,18 @@
|
||||
#include <utility>
|
||||
#include <type_traits>
|
||||
|
||||
#include <__undef_min_max>
|
||||
|
||||
#include <__debug>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
_LIBCPP_PUSH_MACROS
|
||||
#include <__undef_macros>
|
||||
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
template <class _Key, class _Tp>
|
||||
union __hash_value_type;
|
||||
@@ -136,7 +137,7 @@ inline _LIBCPP_INLINE_VISIBILITY
|
||||
size_t
|
||||
__next_hash_pow2(size_t __n)
|
||||
{
|
||||
return size_t(1) << (std::numeric_limits<size_t>::digits - __clz(__n-1));
|
||||
return __n < 2 ? __n : (size_t(1) << (std::numeric_limits<size_t>::digits - __clz(__n-1)));
|
||||
}
|
||||
|
||||
|
||||
@@ -798,8 +799,7 @@ public:
|
||||
_NOEXCEPT_(is_nothrow_copy_constructible<allocator_type>::value)
|
||||
: __data_(__size, __a) {}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__bucket_list_deallocator(__bucket_list_deallocator&& __x)
|
||||
_NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value)
|
||||
@@ -807,8 +807,7 @@ public:
|
||||
{
|
||||
__x.size() = 0;
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#endif
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type& size() _NOEXCEPT {return __data_.first();}
|
||||
@@ -1402,7 +1401,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(const hasher& __hf,
|
||||
const key_equal& __eql,
|
||||
const allocator_type& __a)
|
||||
: __bucket_list_(nullptr, __bucket_list_deleter(__pointer_allocator(__a), 0)),
|
||||
__p1_(__node_allocator(__a)),
|
||||
__p1_(__second_tag(), __node_allocator(__a)),
|
||||
__p2_(0, __hf),
|
||||
__p3_(1.0f, __eql)
|
||||
{
|
||||
@@ -1411,7 +1410,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(const hasher& __hf,
|
||||
template <class _Tp, class _Hash, class _Equal, class _Alloc>
|
||||
__hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(const allocator_type& __a)
|
||||
: __bucket_list_(nullptr, __bucket_list_deleter(__pointer_allocator(__a), 0)),
|
||||
__p1_(__node_allocator(__a)),
|
||||
__p1_(__second_tag(), __node_allocator(__a)),
|
||||
__p2_(0),
|
||||
__p3_(1.0f)
|
||||
{
|
||||
@@ -1423,7 +1422,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(const __hash_table& __u)
|
||||
__bucket_list_deleter(allocator_traits<__pointer_allocator>::
|
||||
select_on_container_copy_construction(
|
||||
__u.__bucket_list_.get_deleter().__alloc()), 0)),
|
||||
__p1_(allocator_traits<__node_allocator>::
|
||||
__p1_(__second_tag(), allocator_traits<__node_allocator>::
|
||||
select_on_container_copy_construction(__u.__node_alloc())),
|
||||
__p2_(0, __u.hash_function()),
|
||||
__p3_(__u.__p3_)
|
||||
@@ -1434,7 +1433,7 @@ template <class _Tp, class _Hash, class _Equal, class _Alloc>
|
||||
__hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(const __hash_table& __u,
|
||||
const allocator_type& __a)
|
||||
: __bucket_list_(nullptr, __bucket_list_deleter(__pointer_allocator(__a), 0)),
|
||||
__p1_(__node_allocator(__a)),
|
||||
__p1_(__second_tag(), __node_allocator(__a)),
|
||||
__p2_(0, __u.hash_function()),
|
||||
__p3_(__u.__p3_)
|
||||
{
|
||||
@@ -1468,7 +1467,7 @@ template <class _Tp, class _Hash, class _Equal, class _Alloc>
|
||||
__hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(__hash_table&& __u,
|
||||
const allocator_type& __a)
|
||||
: __bucket_list_(nullptr, __bucket_list_deleter(__pointer_allocator(__a), 0)),
|
||||
__p1_(__node_allocator(__a)),
|
||||
__p1_(__second_tag(), __node_allocator(__a)),
|
||||
__p2_(0, _VSTD::move(__u.hash_function())),
|
||||
__p3_(_VSTD::move(__u.__p3_))
|
||||
{
|
||||
@@ -2670,6 +2669,9 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__subscriptable(const const_iterator*,
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_DEBUG_LEVEL >= 2
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
_LIBCPP_POP_MACROS
|
||||
|
||||
#endif // _LIBCPP__HASH_TABLE
|
||||
|
||||
Reference in New Issue
Block a user