From 1b4f238a251401caaa34d0bb5d81c13a89f329b0 Mon Sep 17 00:00:00 2001 From: Phillip Khandeliants Date: Thu, 27 Apr 2017 12:13:05 +0300 Subject: [PATCH] Fixed V610: Undefined behavior In an arithmetic expression, all the variables whose values can be represented with type 'int' will be promoted to this type. Therefore, the result of the '~mask' expression is a negative number. By the C++ standard, shifting a negative number to the left leads to an undefined behavior. --- Engine/source/core/strings/unicode.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Engine/source/core/strings/unicode.cpp b/Engine/source/core/strings/unicode.cpp index 109327fe1..fd2341b7b 100644 --- a/Engine/source/core/strings/unicode.cpp +++ b/Engine/source/core/strings/unicode.cpp @@ -469,7 +469,7 @@ U32 oneUTF32toUTF8(const UTF32 codepoint, UTF8 *threeByteCodeunitBuf) //----------------- U8 mask = sgByteMask8LUT[0]; // 0011 1111 - U8 marker = ( ~mask << 1); // 1000 0000 + U8 marker = ( ~static_cast(mask) << 1u); // 1000 0000 // Process the low order bytes, shifting the codepoint down 6 each pass. for( S32 i = bytecount-1; i > 0; i--)