MCPcopy Create free account
hub / github.com/ClickHouse/ClickHouse / computeBytesBeforeCodePoint

Function computeBytesBeforeCodePoint

src/Common/UTF8Helpers.cpp:225–237  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

223
224
225size_t computeBytesBeforeCodePoint(const UInt8 * data, size_t size, size_t limit) noexcept
226{
227 size_t code_point = 0;
228 size_t bytes = 0;
229
230 while (bytes < size && code_point < limit)
231 {
232 bytes += seqLength(data[bytes]);
233 ++code_point;
234 }
235
236 return std::min(bytes, size);
237}
238
239
240size_t convertCodePointToUTF8(int code_point, char * out_bytes, size_t out_length)

Callers 1

highlightFunction · 0.85

Calls 2

seqLengthFunction · 0.85
minFunction · 0.50

Tested by

no test coverage detected