| 242 | } |
| 243 | |
| 244 | Utf32Type utf32FromUtf16SurrogatePair(Utf32Type lead, Utf32Type trail) { |
| 245 | if (!isUtf16LeadSurrogate(lead)) |
| 246 | throw UnicodeException("Invalid lead surrogate passed to utf32FromUtf16SurrogatePair"); |
| 247 | if (!isUtf16TrailSurrogate(trail)) |
| 248 | throw UnicodeException("Invalid trail surrogate passed to utf32FromUtf16SurrogatePair"); |
| 249 | |
| 250 | lead -= MIN_LEAD; |
| 251 | trail -= MIN_TRAIL; |
| 252 | |
| 253 | Utf32Type codepoint = (lead << 10) + trail + MIN_PAIR; |
| 254 | |
| 255 | return codepoint; |
| 256 | } |
| 257 | |
| 258 | pair<Utf32Type, Maybe<Utf32Type>> utf32ToUtf16SurrogatePair(Utf32Type codepoint) { |
| 259 | if (codepoint >= MIN_PAIR) { |
no test coverage detected