| 263 | }; |
| 264 | |
| 265 | static unsigned inline decode(unsigned* state, unsigned* codep, unsigned byte) { |
| 266 | unsigned type = utf8d[byte]; |
| 267 | |
| 268 | *codep = (*state != UTF8_ACCEPT) ? |
| 269 | (byte & 0x3fu) | (*codep << 6) : |
| 270 | (0xff >> type) & (byte); |
| 271 | |
| 272 | *state = utf8d[256 + *state + type]; |
| 273 | return *state; |
| 274 | } |
| 275 | |
| 276 | //static bool IsUTF8(unsigned char* s) { |
| 277 | // unsigned codepoint, state = 0; |