Read-only mirrors. Development, issues and pull requests are on GitHub.

summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorLeitwolf112026-11-18 02:26:03 +0300
committerLeitwolf112026-11-18 02:26:03 +0300
commit646dfa6599c09bc60041c8dc5a0ff7243b215504 (patch)
tree1ebb3846c15ebfe997b7164dd3feef6cbc8a95ab
parentd06447420eca086cc8838f1bf5a5c5479226b252 (diff)
downloadcatch3-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.hpp2
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 );