diff options
| author | Leitwolf11 | 2026-11-18 02:26:03 +0300 |
|---|---|---|
| committer | Leitwolf11 | 2026-11-18 02:26:03 +0300 |
| commit | 646dfa6599c09bc60041c8dc5a0ff7243b215504 (patch) | |
| tree | 1ebb3846c15ebfe997b7164dd3feef6cbc8a95ab | |
| parent | d06447420eca086cc8838f1bf5a5c5479226b252 (diff) | |
| download | catch3-646dfa6599c09bc60041c8dc5a0ff7243b215504.tar.gz | |
Keep toLower free of a sign conversion
`isUpper << 5` promotes the bool to int, so or-ing it into the
unsigned value converted a signed int and failed -Wsign-conversion.
Shift an unsigned value instead; the result is the same for every char.
| -rw-r--r-- | src/Progmasoft/Catch3/Internal/StringManip.hpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/Progmasoft/Catch3/Internal/StringManip.hpp b/src/Progmasoft/Catch3/Internal/StringManip.hpp index 474d6e55..7b43d045 100644 --- a/src/Progmasoft/Catch3/Internal/StringManip.hpp +++ b/src/Progmasoft/Catch3/Internal/StringManip.hpp @@ -28,7 +28,7 @@ namespace Catch { constexpr char toLower( char c ) { const uint32_t as_number = static_cast<unsigned char>( c ); const bool isUpper = ( as_number - static_cast<uint32_t>( 'A' ) ) < 26u; - return static_cast<char>( as_number | ( isUpper << 5 ) ); + return static_cast<char>( as_number | ( static_cast<uint32_t>( isUpper ) << 5u ) ); } //! Returns a new string without whitespace at the start/end std::string trim( std::string const& str ); |