public inbox for libstdc++-cvs@sourceware.org
help / color / mirror / Atom feed
From: Jonathan Wakely <redi@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org, libstdc++-cvs@gcc.gnu.org
Subject: [gcc r13-2818] libstdc++: Micro-optimizaion for std::bitset stream extraction
Date: Fri, 23 Sep 2022 14:15:03 +0000 (GMT)	[thread overview]
Message-ID: <20220923141503.73C723858C52@sourceware.org> (raw)

https://gcc.gnu.org/g:ab98b4c0725eb7c0f03d319ef3e22ae761b2698a

commit r13-2818-gab98b4c0725eb7c0f03d319ef3e22ae761b2698a
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Fri Sep 23 13:39:31 2022 +0100

    libstdc++: Micro-optimizaion for std::bitset stream extraction
    
    Don't bother trying to copy any characters for bitset<0>.
    
    libstdc++-v3/ChangeLog:
    
            * include/std/bitset (operator>>): Do not copy for N==0.
            * testsuite/20_util/bitset/io/input.cc: Add comment.

Diff:
---
 libstdc++-v3/include/std/bitset                   | 2 +-
 libstdc++-v3/testsuite/20_util/bitset/io/input.cc | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/libstdc++-v3/include/std/bitset b/libstdc++-v3/include/std/bitset
index 83c6416b770..6dbc58c6429 100644
--- a/libstdc++-v3/include/std/bitset
+++ b/libstdc++-v3/include/std/bitset
@@ -1615,7 +1615,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
 
       if (__tmp.empty() && _Nb)
 	__state |= __ios_base::failbit;
-      else
+      else if _GLIBCXX17_CONSTEXPR (_Nb)
 	__x._M_copy_from_string(__tmp, static_cast<size_t>(0), _Nb,
 				__zero, __one);
       if (__state)
diff --git a/libstdc++-v3/testsuite/20_util/bitset/io/input.cc b/libstdc++-v3/testsuite/20_util/bitset/io/input.cc
index 939861b171e..0f22cefbb5b 100644
--- a/libstdc++-v3/testsuite/20_util/bitset/io/input.cc
+++ b/libstdc++-v3/testsuite/20_util/bitset/io/input.cc
@@ -39,7 +39,7 @@ void test01()
   ss.clear();
   ss.str("*");
   ss >> b0;
-  VERIFY( ss.rdstate() == ios_base::goodbit );
+  VERIFY( ss.rdstate() == ios_base::goodbit ); // LWG 3199
 }
 
 int main()

                 reply	other threads:[~2022-09-23 14:15 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=20220923141503.73C723858C52@sourceware.org \
    --to=redi@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: link
Be 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).