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

Function utf16ToUtf8

valdi_core/src/valdi_core/cpp/Text/UTF16Utils.cpp:162–172  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

160 i += res.offset;
161 return res.pt;
162 }
163}
164
165static inline void utf16Encode(char32_t pt, std::vector<char16_t>& out) {
166 if (pt < 0x10000) {
167 out.push_back(static_cast<char16_t>(pt));
168 } else if (pt < 0x110000) {
169 out.push_back(static_cast<char16_t>(((pt - 0x10000) >> 10) + 0xD800));
170 out.push_back(static_cast<char16_t>((pt & 0x3FF) + 0xDC00));
171 } else {
172 out.push_back(0xFFFD);
173 }
174}
175

Callers 4

makeStringFromUTF16Method · 0.85
utf8StorageMethod · 0.85
newStringUTF16Method · 0.85
valueToDoubleMethod · 0.85

Calls 5

utf8EncodeFunction · 0.85
utf16DecodeFunction · 0.85
clearMethod · 0.65
dataMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected