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

Nikolas Klauser via libcxx-commits libcxx-commits at lists.llvm.org
Fri Oct 10 07:33:59 PDT 2025


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

None

>From cf16ee987e28a248fee5a9d13df30418d1dd5f03 Mon Sep 17 00:00:00 2001
From: Nikolas Klauser <nikolasklauser at berlin.de>
Date: Fri, 10 Oct 2025 16:29:17 +0200
Subject: [PATCH] [libc++] Remove a redundant check from
 __hash_table::__emplace_unique

---
 libcxx/include/__hash_table | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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();



More information about the libcxx-commits mailing list