From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2181) id 652933861836; Mon, 29 Mar 2021 20:01:53 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 652933861836 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Jonathan Wakely To: gcc-cvs@gcc.gnu.org, libstdc++-cvs@gcc.gnu.org Subject: [gcc r10-9576] libstdc++: Remove redundant branches in countl_one and countr_one [PR 98226] X-Act-Checkin: gcc X-Git-Author: Jonathan Wakely X-Git-Refname: refs/heads/releases/gcc-10 X-Git-Oldrev: e994d3ca7cfc6c90e24e05ef8d7a866f6eb5f6f0 X-Git-Newrev: d7216ea6c0cd6c4fef06e9501bd630c3161b14fd Message-Id: <20210329200153.652933861836@sourceware.org> Date: Mon, 29 Mar 2021 20:01:53 +0000 (GMT) X-BeenThere: libstdc++-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libstdc++-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Mar 2021 20:01:53 -0000 https://gcc.gnu.org/g:d7216ea6c0cd6c4fef06e9501bd630c3161b14fd commit r10-9576-gd7216ea6c0cd6c4fef06e9501bd630c3161b14fd Author: Jonathan Wakely Date: Thu Dec 10 21:57:42 2020 +0000 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. (cherry picked from commit 2ea62857a3fbdf091ba38cbb62e98dc76b198e2e) Diff: --- libstdc++-v3/include/std/bit | 4 ---- 1 file changed, 4 deletions(-) diff --git a/libstdc++-v3/include/std/bit b/libstdc++-v3/include/std/bit index 16f7eba46d7..f22ee528555 100644 --- a/libstdc++-v3/include/std/bit +++ b/libstdc++-v3/include/std/bit @@ -129,8 +129,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); } @@ -172,8 +170,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); }