MCPcopy Create free account
hub / github.com/Tiiny-AI/PowerInfer / utf8_len

Function utf8_len

common/train.cpp:794–798  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

792};
793
794static size_t utf8_len(char src) {
795 const size_t lookup[] = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 3, 4 };
796 uint8_t highbits = static_cast<uint8_t>(src) >> 4;
797 return lookup[highbits];
798}
799
800// mark each byte with its utf8 unit number.
801// returns the number of utf8 characters.

Callers 1

mark_utf8_unitsFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected