| 80 | |
| 81 | template<typename OutIter> |
| 82 | constexpr OutIter write_cp_utf16(char32_t cp, OutIter out) |
| 83 | { |
| 84 | if (cp < 0x10000) { |
| 85 | *out = static_cast<char16_t>(cp); |
| 86 | ++out; |
| 87 | } else { |
| 88 | *out = static_cast<char16_t>(cp >> 10) + high_surrogate_base; |
| 89 | ++out; |
| 90 | *out = static_cast<char16_t>(cp & 0x3ff) + low_surrogate_base; |
| 91 | ++out; |
| 92 | } |
| 93 | return out; |
| 94 | } |
| 95 | |
| 96 | inline constexpr char32_t surrogates_to_cp(char16_t hi, char16_t lo) |
| 97 | { |
no outgoing calls
no test coverage detected