From f12151e527d8d1b39a26b196f3de768c7edce5d0 Mon Sep 17 00:00:00 2001 From: Jonathan Wakely Date: Thu, 29 May 2025 11:29:38 +0100 Subject: [PATCH] libstdc++: Use explicit cast to unsigned in std::rotr and std::rotl MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit This suppresses some -Wsign-conversion warnings from Clang when compiling with -Wsystem-headers. libstdc++-v3/ChangeLog: * include/std/bit (__rotl, __rotr): Use static_cast for conversion from int to unsigned. Reviewed-by: Tomasz Kamiński --- libstdc++-v3/include/std/bit | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libstdc++-v3/include/std/bit b/libstdc++-v3/include/std/bit index 5187c96182f..fd75edf6554 100644 --- a/libstdc++-v3/include/std/bit +++ b/libstdc++-v3/include/std/bit @@ -166,7 +166,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION // Variant for power of two _Nd which the compiler can // easily pattern match. constexpr unsigned __uNd = _Nd; - const unsigned __r = __s; + const auto __r = static_cast(__s); return (__x << (__r % __uNd)) | (__x >> ((-__r) % __uNd)); } const int __r = __s % _Nd; @@ -188,7 +188,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION // Variant for power of two _Nd which the compiler can // easily pattern match. constexpr unsigned __uNd = _Nd; - const unsigned __r = __s; + const auto __r = static_cast(__s); return (__x >> (__r % __uNd)) | (__x << ((-__r) % __uNd)); } const int __r = __s % _Nd; -- 2.47.2