diff options
Diffstat (limited to 'src/internal.c')
-rw-r--r-- | src/internal.c | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/src/internal.c b/src/internal.c index 69f220e..dd1b7f1 100644 --- a/src/internal.c +++ b/src/internal.c @@ -67,29 +67,29 @@ puglDecodeUTF8(const uint8_t* buf) } if (buf[0] < 0xE0) { - FAIL_IF((buf[1] & 0xC0u) != 0x80); - return ((uint32_t)buf[0] << 6u) + buf[1] - 0x3080u; + FAIL_IF((buf[1] & 0xC0U) != 0x80); + return ((uint32_t)buf[0] << 6U) + buf[1] - 0x3080U; } if (buf[0] < 0xF0) { - FAIL_IF((buf[1] & 0xC0u) != 0x80); + FAIL_IF((buf[1] & 0xC0U) != 0x80); FAIL_IF(buf[0] == 0xE0 && buf[1] < 0xA0); - FAIL_IF((buf[2] & 0xC0u) != 0x80); - return ((uint32_t)buf[0] << 12u) + // - ((uint32_t)buf[1] << 6u) + // - ((uint32_t)buf[2] - 0xE2080u); + FAIL_IF((buf[2] & 0xC0U) != 0x80); + return ((uint32_t)buf[0] << 12U) + // + ((uint32_t)buf[1] << 6U) + // + ((uint32_t)buf[2] - 0xE2080U); } if (buf[0] < 0xF5) { - FAIL_IF((buf[1] & 0xC0u) != 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] & 0xC0u) != 0x80u); - FAIL_IF((buf[3] & 0xC0u) != 0x80u); - return (((uint32_t)buf[0] << 18u) + // - ((uint32_t)buf[1] << 12u) + // - ((uint32_t)buf[2] << 6u) + // - ((uint32_t)buf[3] - 0x3C82080u)); + FAIL_IF((buf[2] & 0xC0U) != 0x80U); + FAIL_IF((buf[3] & 0xC0U) != 0x80U); + return (((uint32_t)buf[0] << 18U) + // + ((uint32_t)buf[1] << 12U) + // + ((uint32_t)buf[2] << 6U) + // + ((uint32_t)buf[3] - 0x3C82080U)); } return 0xFFFD; |