MCPcopy Create free account
hub / github.com/apache/arrow / UTF8Encode

Function UTF8Encode

cpp/src/arrow/util/utf8_internal.h:324–343  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

322}
323
324static inline uint8_t* UTF8Encode(uint8_t* str, uint32_t codepoint) {
325 if (codepoint < 0x80) {
326 *str++ = codepoint;
327 } else if (codepoint < 0x800) {
328 *str++ = 0xC0 + (codepoint >> 6);
329 *str++ = 0x80 + (codepoint & 0x3F);
330 } else if (codepoint < 0x10000) {
331 *str++ = 0xE0 + (codepoint >> 12);
332 *str++ = 0x80 + ((codepoint >> 6) & 0x3F);
333 *str++ = 0x80 + (codepoint & 0x3F);
334 } else {
335 // Assume proper codepoints are always passed
336 assert(codepoint < kMaxUnicodeCodepoint);
337 *str++ = 0xF0 + (codepoint >> 18);
338 *str++ = 0x80 + ((codepoint >> 12) & 0x3F);
339 *str++ = 0x80 + ((codepoint >> 6) & 0x3F);
340 *str++ = 0x80 + (codepoint & 0x3F);
341 }
342 return str;
343}
344
345static inline bool UTF8Decode(const uint8_t** data, uint32_t* codepoint) {
346 const uint8_t* str = *data;

Callers 8

UTF8TransformFunction · 0.85
TransformMethod · 0.85
DecomposeMethod · 0.85
SliceForwardMethod · 0.85
SliceBackwardMethod · 0.85
gdv_fn_lower_utf8Function · 0.85
gdv_fn_upper_utf8Function · 0.85
gdv_fn_initcap_utf8Function · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected