30 using char_type =
char;
31 using fallback_encoder_type =
char_map<
"cp-1252">;
32 using fallback_char_type = fallback_encoder_type::char_type;
34 [[
nodiscard]]
constexpr std::endian guess_endian(
void const *ptr,
size_t size, std::endian endian)
const noexcept
36 return std::endian::native;
41 hilet str = std::string_view(&
cu, 1
_uz);
42 auto first = str.begin();
43 hilet[code_point, valid] = fallback_encoder_type{}.read(first, str.end());
44 return {code_point,
false};
47 template<
typename It,
typename EndIt>
57 hi_axiom(length >= 2);
70 if ((
cu & 0xc0) != 0x80) {
83 return {0xfffd,
false};
87 if ((
cu & 0b11'000000) != 0b10'000000) {
89 return {0xfffd,
false};
96 cp |=
cu & 0b00'111111;
101 valid &=
cp < 0x11'0000;
107 return {0xfffd,
false};
113 template<
typename It,
typename EndIt>
116 hi_axiom(
it != last);
131 hi_axiom(code_point < 0x11'0000);
132 hi_axiom(
not(code_point >= 0xd800
and code_point < 0xe000));
134 return {
narrow_cast<uint8_t>((code_point > 0x7f) + (code_point > 0x7ff) + (code_point > 0xffff) + 1),
true};
137 template<
typename It>
138 constexpr void write(
char32_t code_point,
It&
dst)
const noexcept
140 hi_axiom(code_point < 0x11'0000);
141 hi_axiom(
not(code_point >= 0xd800
and code_point < 0xe000));
177#if defined(HI_HAS_SSE2)
178 template<
typename It>
184 template<
typename It>