mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-01-20 04:34:48 +00:00
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.
This commit is contained in:
parent
c0f3c4e2f5
commit
172391e1d3
|
|
@ -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<U32>(mask) << 1u); // 1000 0000
|
||||
|
||||
// Process the low order bytes, shifting the codepoint down 6 each pass.
|
||||
for( S32 i = bytecount-1; i > 0; i--)
|
||||
|
|
|
|||
Loading…
Reference in a new issue