MCPcopy Create free account
hub / github.com/awslabs/aws-lambda-cpp / CreateCodePointFromUtf16SurrogatePair

Function CreateCodePointFromUtf16SurrogatePair

tests/gtest/gtest-all.cc:3291–3302  ·  view source on GitHub ↗

Creates a Unicode code point from UTF16 surrogate pair.

Source from the content-addressed store, hash-verified

3289
3290// Creates a Unicode code point from UTF16 surrogate pair.
3291inline UInt32 CreateCodePointFromUtf16SurrogatePair(wchar_t first,
3292 wchar_t second) {
3293 const auto first_u = static_cast<UInt32>(first);
3294 const auto second_u = static_cast<UInt32>(second);
3295 const UInt32 mask = (1 << 10) - 1;
3296 return (sizeof(wchar_t) == 2)
3297 ? (((first_u & mask) << 10) | (second_u & mask)) + 0x10000
3298 :
3299 // This function should not be called when the condition is
3300 // false, but we provide a sensible default in case it is.
3301 first_u;
3302}
3303
3304// Converts a wide string to a narrow string in UTF-8 encoding.
3305// The wide string is assumed to have the following encoding:

Callers 1

WideStringToUtf8Function · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected