This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct DecodeResult { | |
uint32_t codepoint; | |
uint32_t decodedBytes; | |
}; | |
static inline struct DecodeResult DecodeOneUTF8(const uint8_t *utf8) { | |
static uint8_t byteCountTable[16] = { | |
// 0xxx | |
[0x0] = 1, | |
[0x1] = 1, |