diff options
Diffstat (limited to 'pugl/detail/implementation.c')
-rw-r--r-- | pugl/detail/implementation.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/pugl/detail/implementation.c b/pugl/detail/implementation.c index a2ff2ec..df87276 100644 --- a/pugl/detail/implementation.c +++ b/pugl/detail/implementation.c @@ -259,22 +259,22 @@ puglDecodeUTF8(const uint8_t* buf) } else if (buf[0] < 0xC2) { return 0xFFFD; } else if (buf[0] < 0xE0) { - FAIL_IF((buf[1] & 0xC0) != 0x80); - return (buf[0] << 6) + buf[1] - 0x3080u; + FAIL_IF((buf[1] & 0xC0u) != 0x80); + return (buf[0] << 6u) + buf[1] - 0x3080u; } else if (buf[0] < 0xF0) { - FAIL_IF((buf[1] & 0xC0) != 0x80); + FAIL_IF((buf[1] & 0xC0u) != 0x80); FAIL_IF(buf[0] == 0xE0 && buf[1] < 0xA0); - FAIL_IF((buf[2] & 0xC0) != 0x80); - return (buf[0] << 12) + (buf[1] << 6) + buf[2] - 0xE2080u; + FAIL_IF((buf[2] & 0xC0u) != 0x80); + return (buf[0] << 12u) + (buf[1] << 6u) + buf[2] - 0xE2080u; } else if (buf[0] < 0xF5) { - FAIL_IF((buf[1] & 0xC0) != 0x80); + FAIL_IF((buf[1] & 0xC0u) != 0x80); FAIL_IF(buf[0] == 0xF0 && buf[1] < 0x90); FAIL_IF(buf[0] == 0xF4 && buf[1] >= 0x90); - FAIL_IF((buf[2] & 0xC0) != 0x80); - FAIL_IF((buf[3] & 0xC0) != 0x80); - return ((buf[0] << 18) + - (buf[1] << 12) + - (buf[2] << 6) + + FAIL_IF((buf[2] & 0xC0u) != 0x80u); + FAIL_IF((buf[3] & 0xC0u) != 0x80u); + return ((buf[0] << 18u) + + (buf[1] << 12u) + + (buf[2] << 6u) + buf[3] - 0x3C82080u); } return 0xFFFD; |