MCPcopy Create free account
hub / github.com/deathkiller/jazz2-native / FromCodePoint

Function FromCodePoint

Sources/Shared/Utf8.cpp:89–119  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

87 }
88
89 std::size_t FromCodePoint(char32_t character, Containers::StaticArrayView<4, char> result)
90 {
91 if (character < U'\x00000080') {
92 result[0] = 0x00 | ((character >> 0) & 0x7f);
93 return 1;
94 }
95
96 if (character < U'\x00000800') {
97 result[0] = 0xc0 | ((character >> 6) & 0x1f);
98 result[1] = 0x80 | ((character >> 0) & 0x3f);
99 return 2;
100 }
101
102 if (character < U'\x00010000') {
103 result[0] = 0xe0 | ((character >> 12) & 0x0f);
104 result[1] = 0x80 | ((character >> 6) & 0x3f);
105 result[2] = 0x80 | ((character >> 0) & 0x3f);
106 return 3;
107 }
108
109 if (character < U'\x00110000') {
110 result[0] = 0xf0 | ((character >> 18) & 0x07);
111 result[1] = 0x80 | ((character >> 12) & 0x3f);
112 result[2] = 0x80 | ((character >> 6) & 0x3f);
113 result[3] = 0x80 | ((character >> 0) & 0x3f);
114 return 4;
115 }
116
117 // Value outside of UTF-32 range
118 return 0;
119 }
120
121#if defined(DEATH_TARGET_WINDOWS)
122

Callers 2

charCallbackMethod · 0.85
processKeyboardEventMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected