MCPcopy Create free account
hub / github.com/crosspoint-reader/crosspoint-reader / utf8CodepointLen

Function utf8CodepointLen

lib/Utf8/Utf8.cpp:71–77  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

69}
70
71int 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
79uint32_t utf8NextCodepoint(const unsigned char** string) {
80 if (**string == 0) {

Callers 2

utf8NextCodepointFunction · 0.85
utf8SafeTruncateBufferFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected