MCPcopy Create free account
hub / github.com/StereoKit/StereoKit / utf16_decode_fast

Function utf16_decode_fast

StereoKitC/libraries/unicode.cpp:344–358  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

342///////////////////////////////////////////
343
344char32_t utf16_decode_fast(const char16_t *utf16_str, const char16_t **out_next) {
345 if (utf16_str[0] < 0xd800 || utf16_str[0] > 0xdfff) {
346 char32_t result = utf16_str[0];
347 *out_next = utf16_str + 1;
348 return result;
349
350 } else if (utf16_str[0] >= 0xd800 && utf16_str[0] <= 0xdbff &&
351 utf16_str[1] >= 0xdc00 && utf16_str[1] <= 0xdfff) {
352
353 char32_t result = (((utf16_str[0] & 0x03ffL) << 10) | ((utf16_str[1] & 0x03ffL) << 0)) + 0x00010000L;
354 *out_next = utf16_str + 2;
355 return result;
356 }
357 return 0;
358}
359
360///////////////////////////////////////////
361

Callers 1

utf16_decode_fast_bFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected