From patchwork Fri Sep 23 14:15:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Wakely X-Patchwork-Id: 57971 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 61F173857368 for ; Fri, 23 Sep 2022 14:16:26 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 61F173857368 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1663942586; bh=n/bLFE3oem36BYMfibbCFfIUeoZtkSApI62f3pKdjfE=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=rmDob4ZjgssyG12iYvzSjhjwMtoz3H+WdFCuJeWdUU2k+ntkELCvB0ZDJp26kDd6U /93wfdZYd8Af6JCTcLeSsqL4/LVY1KjWy+J68SeomUavZ5ZoBwHpai+dEW+5kMRmiR 2lx9n2oqzAOVPF0ipB9gKB3sskKHKnzEIfITXVok= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id A611F3857BA2 for ; Fri, 23 Sep 2022 14:15:26 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org A611F3857BA2 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-212-8rp0DKXFNBKOpvLjGKob1w-1; Fri, 23 Sep 2022 10:15:23 -0400 X-MC-Unique: 8rp0DKXFNBKOpvLjGKob1w-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id F2E95101A52A; Fri, 23 Sep 2022 14:15:22 +0000 (UTC) Received: from localhost (unknown [10.33.36.214]) by smtp.corp.redhat.com (Postfix) with ESMTP id BC819112132D; Fri, 23 Sep 2022 14:15:22 +0000 (UTC) To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: [committed] libstdc++: Micro-optimizaion for std::bitset stream extraction Date: Fri, 23 Sep 2022 15:15:22 +0100 Message-Id: <20220923141522.1393426-1-jwakely@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-12.3 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Jonathan Wakely via Gcc-patches From: Jonathan Wakely Reply-To: Jonathan Wakely Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" Tested x86_64-linux, pushed to trunk. -- >8 -- 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. --- 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(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()