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

Function UTF8EncodedLength

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

Return the number of bytes required to UTF8-encode the given codepoint

Source from the content-addressed store, hash-verified

310
311/// Return the number of bytes required to UTF8-encode the given codepoint
312static inline int32_t UTF8EncodedLength(uint32_t codepoint) {
313 if (codepoint < 0x80) {
314 return 1;
315 } else if (codepoint < 0x800) {
316 return 2;
317 } else if (codepoint < 0x10000) {
318 return 3;
319 } else {
320 return 4;
321 }
322}
323
324static inline uint8_t* UTF8Encode(uint8_t* str, uint32_t codepoint) {
325 if (codepoint < 0x80) {

Callers 1

DecomposeMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected