public inbox for libstdc++@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jonathan Wakely <jwakely@redhat.com>
To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org
Subject: [committed] libstdc++: Remove redundant check for zero in std::__popcount
Date: Mon, 9 Nov 2020 14:54:44 +0000	[thread overview]
Message-ID: <20201109145444.GA3917696@redhat.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 214 bytes --]

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.


[-- Attachment #2: patch.txt --]
[-- Type: text/plain, Size: 985 bytes --]

commit ff4bfb1553cf525d7299bbf7451ac32cfd97ae1b
Author: Jonathan Wakely <jwakely@redhat.com>
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<unsigned long long>::__digits;
       constexpr auto _Nd_ul = __int_traits<unsigned long>::__digits;
       constexpr auto _Nd_u = __int_traits<unsigned>::__digits;

                 reply	other threads:[~2020-11-09 14:54 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=20201109145444.GA3917696@redhat.com \
    --to=jwakely@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=libstdc++@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).