* [committed] libstdc++: Remove redundant branches in countl_one and countr_one [PR 98226]
@ 2020-12-10 22:00 Jonathan Wakely
0 siblings, 0 replies; only message in thread
From: Jonathan Wakely @ 2020-12-10 22:00 UTC (permalink / raw)
To: libstdc++, gcc-patches
[-- Attachment #1: Type: text/plain, Size: 288 bytes --]
There's no need to explicitly check for the maximum value, because the
function we call handles it correctly anyway.
libstdc++-v3/ChangeLog:
PR libstdc++/98226
* include/std/bit (__countl_one, __countr_one): Remove redundant
branches.
Tested powerpc64le-linux. Committed to trunk.
[-- Attachment #2: patch.txt --]
[-- Type: text/plain, Size: 1239 bytes --]
commit 2ea62857a3fbdf091ba38cbb62e98dc76b198e2e
Author: Jonathan Wakely <jwakely@redhat.com>
Date: Thu Dec 10 21:57:42 2020
libstdc++: Remove redundant branches in countl_one and countr_one [PR 98226]
There's no need to explicitly check for the maximum value, because the
function we call handles it correctly anyway.
libstdc++-v3/ChangeLog:
PR libstdc++/98226
* include/std/bit (__countl_one, __countr_one): Remove redundant
branches.
diff --git a/libstdc++-v3/include/std/bit b/libstdc++-v3/include/std/bit
index 1d99c807c4a..6f47f89ab03 100644
--- a/libstdc++-v3/include/std/bit
+++ b/libstdc++-v3/include/std/bit
@@ -141,8 +141,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
constexpr int
__countl_one(_Tp __x) noexcept
{
- if (__x == __gnu_cxx::__int_traits<_Tp>::__max)
- return __gnu_cxx::__int_traits<_Tp>::__digits;
return std::__countl_zero<_Tp>((_Tp)~__x);
}
@@ -184,8 +182,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
constexpr int
__countr_one(_Tp __x) noexcept
{
- if (__x == __gnu_cxx::__int_traits<_Tp>::__max)
- return __gnu_cxx::__int_traits<_Tp>::__digits;
return std::__countr_zero((_Tp)~__x);
}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2020-12-10 22:18 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-10 22:00 [committed] libstdc++: Remove redundant branches in countl_one and countr_one [PR 98226] Jonathan Wakely
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).