MCPcopy Create free account
hub / github.com/Vector35/binaryninja-api / EncodeUnsafe

Function EncodeUnsafe

rapidjson/encodings.h:124–143  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

122
123 template<typename OutputStream>
124 static void EncodeUnsafe(OutputStream& os, unsigned codepoint) {
125 if (codepoint <= 0x7F)
126 PutUnsafe(os, static_cast<Ch>(codepoint & 0xFF));
127 else if (codepoint <= 0x7FF) {
128 PutUnsafe(os, static_cast<Ch>(0xC0 | ((codepoint >> 6) & 0xFF)));
129 PutUnsafe(os, static_cast<Ch>(0x80 | ((codepoint & 0x3F))));
130 }
131 else if (codepoint <= 0xFFFF) {
132 PutUnsafe(os, static_cast<Ch>(0xE0 | ((codepoint >> 12) & 0xFF)));
133 PutUnsafe(os, static_cast<Ch>(0x80 | ((codepoint >> 6) & 0x3F)));
134 PutUnsafe(os, static_cast<Ch>(0x80 | (codepoint & 0x3F)));
135 }
136 else {
137 RAPIDJSON_ASSERT(codepoint <= 0x10FFFF);
138 PutUnsafe(os, static_cast<Ch>(0xF0 | ((codepoint >> 18) & 0xFF)));
139 PutUnsafe(os, static_cast<Ch>(0x80 | ((codepoint >> 12) & 0x3F)));
140 PutUnsafe(os, static_cast<Ch>(0x80 | ((codepoint >> 6) & 0x3F)));
141 PutUnsafe(os, static_cast<Ch>(0x80 | (codepoint & 0x3F)));
142 }
143 }
144
145 template <typename InputStream>
146 static bool Decode(InputStream& is, unsigned* codepoint) {

Callers 1

TranscodeUnsafeMethod · 0.85

Calls 1

PutUnsafeFunction · 0.70

Tested by

no test coverage detected