* Returns a tuple (high,low) as UTF-16 */
| 722 | * Returns a tuple (high,low) as UTF-16 |
| 723 | */ |
| 724 | std::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 |
nothing calls this directly
no outgoing calls
no test coverage detected