MCPcopy Create free account
hub / github.com/Aloshi/EmulationStation / decode_utf16_block

Method decode_utf16_block

src/pugiXML/pugixml.cpp:909–951  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

907 }
908
909 static inline typename Traits::value_type decode_utf16_block(const uint16_t* data, size_t size, typename Traits::value_type result)
910 {
911 const uint16_t* end = data + size;
912
913 while (data < end)
914 {
915 uint16_t lead = opt_swap::value ? endian_swap(*data) : *data;
916
917 // U+0000..U+D7FF
918 if (lead < 0xD800)
919 {
920 result = Traits::low(result, lead);
921 data += 1;
922 }
923 // U+E000..U+FFFF
924 else if (static_cast<unsigned int>(lead - 0xE000) < 0x2000)
925 {
926 result = Traits::low(result, lead);
927 data += 1;
928 }
929 // surrogate pair lead
930 else if (static_cast<unsigned int>(lead - 0xD800) < 0x400 && data + 1 < end)
931 {
932 uint16_t next = opt_swap::value ? endian_swap(data[1]) : data[1];
933
934 if (static_cast<unsigned int>(next - 0xDC00) < 0x400)
935 {
936 result = Traits::high(result, 0x10000 + ((lead & 0x3ff) << 10) + (next & 0x3ff));
937 data += 2;
938 }
939 else
940 {
941 data += 1;
942 }
943 }
944 else
945 {
946 data += 1;
947 }
948 }
949
950 return result;
951 }
952
953 static inline typename Traits::value_type decode_utf32_block(const uint32_t* data, size_t size, typename Traits::value_type result)
954 {

Callers

nothing calls this directly

Calls 1

endian_swapFunction · 0.85

Tested by

no test coverage detected