| 69 | } |
| 70 | |
| 71 | int utf8CodepointLen(const unsigned char c) { |
| 72 | if (c < 0x80) return 1; // 0xxxxxxx |
| 73 | if ((c >> 5) == 0x6) return 2; // 110xxxxx |
| 74 | if ((c >> 4) == 0xE) return 3; // 1110xxxx |
| 75 | if ((c >> 3) == 0x1E) return 4; // 11110xxx |
| 76 | return 1; // fallback for invalid |
| 77 | } |
| 78 | |
| 79 | uint32_t utf8NextCodepoint(const unsigned char** string) { |
| 80 | if (**string == 0) { |
no outgoing calls
no test coverage detected