[libcxx-commits] [libcxx] [libc++] Remove a redundant check from __hash_table::__emplace_unique (PR #162856)

via libcxx-commits libcxx-commits at lists.llvm.org
Fri Oct 10 07:34:37 PDT 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-libcxx

Author: Nikolas Klauser (philnik777)

<details>
<summary>Changes</summary>



---
Full diff: https://github.com/llvm/llvm-project/pull/162856.diff


1 Files Affected:

- (modified) libcxx/include/__hash_table (+1-1) 


``````````diff
diff --git a/libcxx/include/__hash_table b/libcxx/include/__hash_table
index 74923ddb74e9c..6b65e738fef3b 100644
--- a/libcxx/include/__hash_table
+++ b/libcxx/include/__hash_table
@@ -808,7 +808,7 @@ public:
           }
           {
             __node_holder __h = __construct_node_hash(__hash, std::forward<_Args>(__args2)...);
-            if (size() + 1 > __bc * max_load_factor() || __bc == 0) {
+            if (size() + 1 > __bc * max_load_factor()) {
               __rehash_unique(std::max<size_type>(2 * __bc + !std::__is_hash_power2(__bc),
                                                   size_type(__math::ceil(float(size() + 1) / max_load_factor()))));
               __bc    = bucket_count();

``````````

</details>


https://github.com/llvm/llvm-project/pull/162856


More information about the libcxx-commits mailing list