MCPcopy Create free account
hub / github.com/NativeScript/android / utf32_length_from_utf8

Function utf32_length_from_utf8

test-app/runtime/src/main/cpp/ada/ada.cpp:258–265  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

256}
257
258size_t utf32_length_from_utf8(const char* buf, size_t len) {
259 const int8_t* p = reinterpret_cast<const int8_t*>(buf);
260 return std::count_if(p, std::next(p, len), [](int8_t c) {
261 // -65 is 0b10111111, anything larger in two-complement's
262 // should start a new code point.
263 return c > -65;
264 });
265}
266
267size_t utf32_to_utf8(const char32_t* buf, size_t len, char* utf8_output) {
268 const uint32_t* data = reinterpret_cast<const uint32_t*>(buf);

Callers 1

to_asciiFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected