diff --git a/src/util/stringutil.cpp b/src/util/stringutil.cpp index 927e998f..29bd6a1f 100644 --- a/src/util/stringutil.cpp +++ b/src/util/stringutil.cpp @@ -37,22 +37,22 @@ wstring util::rfill(wstring s, uint length, wchar_t c) { uint util::encode_utf8(uint32_t c, ubyte* bytes) { if (c < 0x80) { - bytes[0] = c >> 0 & 0x7F | 0x00; + bytes[0] = ((c >> 0) & 0x7F) | 0x00; return 1; } else if (c < 0x0800) { - bytes[0] = c >> 6 & 0x1F | 0xC0; - bytes[1] = c >> 0 & 0x3F | 0x80; + bytes[0] = ((c >> 6) & 0x1F) | 0xC0; + bytes[1] = ((c >> 0) & 0x3F) | 0x80; return 2; } else if (c < 0x010000) { - bytes[0] = c >> 12 & 0x0F | 0xE0; - bytes[1] = c >> 6 & 0x3F | 0x80; - bytes[2] = c >> 0 & 0x3F | 0x80; + bytes[0] = ((c >> 12) & 0x0F) | 0xE0; + bytes[1] = ((c >> 6) & 0x3F) | 0x80; + bytes[2] = ((c >> 0) & 0x3F) | 0x80; return 3; } else { - bytes[0] = c >> 18 & 0x07 | 0xF0; - bytes[1] = c >> 12 & 0x3F | 0x80; - bytes[2] = c >> 6 & 0x3F | 0x80; - bytes[3] = c >> 0 & 0x3F | 0x80; + bytes[0] = ((c >> 18) & 0x07) | 0xF0; + bytes[1] = ((c >> 12) & 0x3F) | 0x80; + bytes[2] = ((c >> 6) & 0x3F) | 0x80; + bytes[3] = ((c >> 0) & 0x3F) | 0x80; return 4; } }