Avoid shifting negative value

This commit is contained in:
Paul Cornett
2019-02-17 22:20:50 -08:00
parent 71972a5265
commit 0cb9231720

View File

@@ -1425,7 +1425,7 @@ size_t wxMBConvUTF8::FromWChar(char *buf, size_t n,
len += cnt + 1;
if (buf)
{
*buf++ = (char) ((-128 >> cnt) | ((cc >> (cnt * 6)) & (0x3f >> cnt)));
*buf++ = (char) ((~0x7fu >> cnt) | ((cc >> (cnt * 6)) & (0x3f >> cnt)));
while (cnt--)
*buf++ = (char) (0x80 | ((cc >> (cnt * 6)) & 0x3f));
}