MCPcopy Create free account
hub / github.com/0xShug0/audio.cpp / unicode_len_utf8

Function unicode_len_utf8

external/llama_tokenizer/unicode.cpp:16–20  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

14#include <vector>
15
16size_t unicode_len_utf8(char src) {
17 const size_t lookup[] = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 3, 4 };
18 uint8_t highbits = static_cast<uint8_t>(src) >> 4;
19 return lookup[highbits];
20}
21
22static std::string unicode_cpts_to_utf8(const std::vector<uint32_t> & cps) {
23 std::string result;

Callers 1

tokenizeMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected