Skip to content

Commit bc3bc74

Browse files
authored
[libc++] Remove a redundant check from __hash_table::__emplace_unique (#162856)
The `|| __bc == 0` case will never be relevant, since we know that `size() + 1` will always be exactly 1 if `__bc == 0` and `0 * max_load_factor()` will be zero, so the branch will already be taken due to the first condition.
1 parent 1f9a70f commit bc3bc74

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

libcxx/include/__hash_table

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -808,7 +808,7 @@ public:
808808
}
809809
{
810810
__node_holder __h = __construct_node_hash(__hash, std::forward<_Args>(__args2)...);
811-
if (size() + 1 > __bc * max_load_factor() || __bc == 0) {
811+
if (size() + 1 > __bc * max_load_factor()) {
812812
__rehash_unique(std::max<size_type>(2 * __bc + !std::__is_hash_power2(__bc),
813813
size_type(__math::ceil(float(size() + 1) / max_load_factor()))));
814814
__bc = bucket_count();

0 commit comments

Comments
 (0)