From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by sourceware.org (Postfix) with ESMTP id 611D5386191C for ; Mon, 9 Nov 2020 14:54:51 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 611D5386191C Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-189-By8n0qJKNyOQkhIIaIVaDQ-1; Mon, 09 Nov 2020 09:54:47 -0500 X-MC-Unique: By8n0qJKNyOQkhIIaIVaDQ-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id ED812801AF1; Mon, 9 Nov 2020 14:54:45 +0000 (UTC) Received: from localhost (unknown [10.33.36.44]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8F1075B4AB; Mon, 9 Nov 2020 14:54:45 +0000 (UTC) Date: Mon, 9 Nov 2020 14:54:44 +0000 From: Jonathan Wakely To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: [committed] libstdc++: Remove redundant check for zero in std::__popcount Message-ID: <20201109145444.GA3917696@redhat.com> MIME-Version: 1.0 X-Clacks-Overhead: GNU Terry Pratchett X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: multipart/mixed; boundary="MGYHOYXEY6WxJCY8" Content-Disposition: inline X-Spam-Status: No, score=-14.2 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_NONE, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=unavailable autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libstdc++@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libstdc++ mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Nov 2020 14:54:52 -0000 --MGYHOYXEY6WxJCY8 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline The popcount built-ins work fine for zero, so there's no need to check for it. libstdc++-v3/ChangeLog: * include/std/bit (__popcount): Remove redundant check for zero. Tested x86_64-linux. Committed to trunk. --MGYHOYXEY6WxJCY8 Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="patch.txt" commit ff4bfb1553cf525d7299bbf7451ac32cfd97ae1b Author: Jonathan Wakely Date: Mon Nov 9 14:31:13 2020 libstdc++: Remove redundant check for zero in std::__popcount The popcount built-ins work fine for zero, so there's no need to check for it. libstdc++-v3/ChangeLog: * include/std/bit (__popcount): Remove redundant check for zero. diff --git a/libstdc++-v3/include/std/bit b/libstdc++-v3/include/std/bit index f4344820d527..16f7eba46d7b 100644 --- a/libstdc++-v3/include/std/bit +++ b/libstdc++-v3/include/std/bit @@ -184,9 +184,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION using __gnu_cxx::__int_traits; constexpr auto _Nd = __int_traits<_Tp>::__digits; - if (__x == 0) - return 0; - constexpr auto _Nd_ull = __int_traits::__digits; constexpr auto _Nd_ul = __int_traits::__digits; constexpr auto _Nd_u = __int_traits::__digits; --MGYHOYXEY6WxJCY8--