MCPcopy Create free account
hub / github.com/Tablecruncher/tablecruncher / encodeUtf16

Method encodeUtf16

src/helper.cpp:724–734  ·  view source on GitHub ↗

* Returns a tuple (high,low) as UTF-16 */

Source from the content-addressed store, hash-verified

722 * Returns a tuple (high,low) as UTF-16
723 */
724std::tuple<uint16_t, uint16_t> Helper::encodeUtf16(uint32_t cp) {
725 if( cp <= 0xD7FF || (cp >= 0xE000 && cp <= 0xFFFF) ) {
726 return std::make_tuple(cp,0);
727 } else if( cp >= 0x10000 && cp <= 0x10FFFF ) {
728 uint16_t high = ((cp - 0x10000) >> 10) + 0xD800;
729 uint16_t low = ((cp - 0x10000) & 0x3FF) + 0xDC00;
730 return std::make_tuple(high,low);
731 } else {
732 return std::make_tuple(cp,0);
733 }
734}
735
736
737

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected