public inbox for libstdc++-cvs@sourceware.org help / color / mirror / Atom feed
From: Francois Dumont <fdumont@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org, libstdc++-cvs@gcc.gnu.org Subject: [gcc r14-8380] libstdc++: [_Hashtable] Remove useless check for _M_before_begin node Date: Wed, 24 Jan 2024 05:37:04 +0000 (GMT) [thread overview] Message-ID: <20240124053704.D9CBF3858CDB@sourceware.org> (raw) https://gcc.gnu.org/g:ec0a68b9ee3e4b3de84816ea22c82214f8a8ceb0 commit r14-8380-gec0a68b9ee3e4b3de84816ea22c82214f8a8ceb0 Author: Huanghui Nie <nnnjkk@gmail.com> Date: Mon Jan 22 06:45:48 2024 +0100 libstdc++: [_Hashtable] Remove useless check for _M_before_begin node When removing the first node of a bucket it is useless to check if this bucket is the one containing the _M_before_begin node. The bucket before-begin node is already transfered to the next pointed-to bucket regardeless if it is the container before-begin node. libstdc++-v3/ChangeLog: * include/bits/hashtable.h (_Hahstable<>::_M_remove_bucket_begin): Remove _M_before_begin check and cleanup implementation. Co-authored-by: Théo Papadopoulo <papadopoulo@gmail.com> Diff: --- libstdc++-v3/include/bits/hashtable.h | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/libstdc++-v3/include/bits/hashtable.h b/libstdc++-v3/include/bits/hashtable.h index b48610036fa..c3ef7a0a3d5 100644 --- a/libstdc++-v3/include/bits/hashtable.h +++ b/libstdc++-v3/include/bits/hashtable.h @@ -869,16 +869,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION _M_remove_bucket_begin(size_type __bkt, __node_ptr __next_n, size_type __next_bkt) { - if (!__next_n || __next_bkt != __bkt) + if (!__next_n) + _M_buckets[__bkt] = nullptr; + else if (__next_bkt != __bkt) { - // Bucket is now empty - // First update next bucket if any - if (__next_n) - _M_buckets[__next_bkt] = _M_buckets[__bkt]; - - // Second update before begin node if necessary - if (&_M_before_begin == _M_buckets[__bkt]) - _M_before_begin._M_nxt = __next_n; + _M_buckets[__next_bkt] = _M_buckets[__bkt]; _M_buckets[__bkt] = nullptr; } }
reply other threads:[~2024-01-24 5:37 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20240124053704.D9CBF3858CDB@sourceware.org \ --to=fdumont@gcc.gnu.org \ --cc=gcc-cvs@gcc.gnu.org \ --cc=libstdc++-cvs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).