MCPcopy Create free account
hub / github.com/Snapchat/Valdi / utf16Encode

Function utf16Encode

valdi_core/src/valdi_core/cpp/Text/UTF16Utils.cpp:151–160  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

149}
150
151static inline void utf16Encode(char32_t pt, std::vector<char16_t>& out) {
152 if (pt < 0x10000) {
153 out.push_back(static_cast<char16_t>(pt));
154 } else if (pt < 0x110000) {
155 out.push_back(static_cast<char16_t>(((pt - 0x10000) >> 10) + 0xD800));
156 out.push_back(static_cast<char16_t>((pt & 0x3FF) + 0xDC00));
157 } else {
158 out.push_back(0xFFFD);
159 }
160}
161
162std::pair<const char*, size_t> utf16ToUtf8(const char16_t* utf16String, size_t len) {
163 thread_local static std::vector<char> tBuffer;

Callers 1

utf8ToUtf16Function · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected