MCPcopy Create free account
hub / github.com/cinder/Cinder / utf8to16

Function utf8to16

include/utf8cpp/checked.h:234–246  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

232
233 template <typename u16bit_iterator, typename octet_iterator>
234 u16bit_iterator utf8to16 (octet_iterator start, octet_iterator end, u16bit_iterator result)
235 {
236 while (start != end) {
237 uint32_t cp = utf8::next(start, end);
238 if (cp > 0xffff) { //make a surrogate pair
239 *result++ = static_cast<uint16_t>((cp >> 10) + internal::LEAD_OFFSET);
240 *result++ = static_cast<uint16_t>((cp & 0x3ff) + internal::TRAIL_SURROGATE_MIN);
241 }
242 else
243 *result++ = static_cast<uint16_t>(cp);
244 }
245 return result;
246 }
247
248 template <typename octet_iterator, typename u32bit_iterator>
249 octet_iterator utf32to8 (u32bit_iterator start, u32bit_iterator end, octet_iterator result)

Callers 1

toUtf16Function · 0.50

Calls 1

nextFunction · 0.70

Tested by

no test coverage detected