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: 1421 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5044:0:0:0:0:0 with SMTP id h4csp239865wrt; Fri, 23 Sep 2022 07:16:41 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4WFTT57zPX+o5nIgRB6UfZk/BARFT8j87QbgEwQi8sjp84LPxPjnYvxNvik+pFZRQp1aEb X-Received: by 2002:a50:c8c3:0:b0:44c:5cb6:5484 with SMTP id k3-20020a50c8c3000000b0044c5cb65484mr8582760edh.285.1663942601736; Fri, 23 Sep 2022 07:16:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663942601; cv=none; d=google.com; s=arc-20160816; b=KSarfSZzsES28QUgU3iPpguZ+sNZYXwMTS3dIc+vrHiWrg2G6sluJL89Z3zoBUbNJk 88maIHZwsZuQ3zU/KOeaaYY5J/sUJQpmd4MBrqQ8UKFGuFJ5ng0f5iqfWj5jfc8folQN CwG6Bh1q5O/OH4QAmIdsnOG3gM+yDQqLe63g9FqTJTVVYrW9xzxSOjA+qYMwbyJbShns O24NkChZbFw7ceyOQB3gcVL1axtAwy6AvmzYn7HBEBI+MHIsYRsCyi2lsMCocyKjbRCP COGoyGngTDES2w5QFWeKNl9j5Az3IfTxRZf24U1DzV9HEQ4Er8/sL40PJavOv3RKadiL YYRw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence :content-transfer-encoding:mime-version:message-id:date:subject:to :dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=n/bLFE3oem36BYMfibbCFfIUeoZtkSApI62f3pKdjfE=; b=wl7ImH3LjYCzXEkn7CuuwHIj1JCpmczr1Tyq942LPs/GloGUGfkt8wb7pevl57NDPM 69XfrYGxY3c465GB/8uSXcG4LjAstUUeqibY4Q0I+ccD3QE26Yogw+wFAUQz8wj8FTky TegvGPIvIMsc8/XIgRu9ePzxARnfuwHgA+OLQ/7hqcQ4Sy8qSwYKrfHXVzvlZLb+hcl1 EuQuREnCybf1Cv2Ua3TZBjnKYAAdlPJM53N1QotPZw3nLJ7bfKLvdeTCfpAS0is0b9V8 lm8fSntbDYoh2WpXdyqcV73TduRuy9+4xSEICzxgQ3oh56DRLKJeNdzR3i6GF6DH8Qh+ UPpg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=K+4nYZot; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id sc28-20020a1709078a1c00b007470b52f94esi8438077ejc.199.2022.09.23.07.16.41 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Sep 2022 07:16:41 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=K+4nYZot; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 859603857373 for ; Fri, 23 Sep 2022 14:16:40 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 859603857373 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1663942600; bh=n/bLFE3oem36BYMfibbCFfIUeoZtkSApI62f3pKdjfE=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=K+4nYZotnfGGZ2qrHbeHCVWuwmlUC4JhDdo9xXThMySZIC8pZkhP4b9zutYWgg6tP Dlu4kgPRExqQeQQSWcXPY2cWZltbKyEZxfv2ep0KkHmI+oFD2u6dZc752z7m6hgM+K pOg4vNATqpWhPZvtKfdCREwakPgzCXz7KkPWdORw= 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+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1744770277348782839?= X-GMAIL-MSGID: =?utf-8?q?1744770277348782839?= 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()