12#include "../utility/module.hpp"
17namespace hi {
inline namespace v1 {
24 using char_type = char;
26 [[nodiscard]]
constexpr std::endian guess_endian(
void const *ptr,
size_t size, std::endian endian)
const noexcept
28 return std::endian::native;
31 template<
typename It,
typename EndIt>
36 hilet c = char_cast<char32_t>(*it++);
40 return {0xfffd,
false};
47 hi_axiom(not(code_point >= 0xd800 and code_point < 0xe000));
49 if (code_point < 0x80) {
50 return {uint8_t{1},
true};
53 return {uint8_t{1},
false};
58 constexpr void write(
char32_t code_point, It& dst)
const noexcept
61 hi_axiom(not(code_point >= 0xd800 and code_point < 0xe000));
63 if (code_point < 0x80) {
64 *dst++ = char_cast<char>(code_point);
71#if defined(HI_HAS_SSE2)
73 hi_force_inline __m128i read_ascii_chunk16(It it)
const noexcept
75 return _mm_loadu_si128(
reinterpret_cast<__m128i
const *
>(
std::addressof(*it)));
79 hi_force_inline
void write_ascii_chunk16(__m128i chunk, It dst)
const noexcept
81 _mm_storeu_si128(
reinterpret_cast<__m128i *
>(
std::addressof(*dst)), chunk);
Definition of the char_converter<From,To> functor.
#define hi_axiom(expression,...)
Specify an axiom; an expression that is true.
Definition assert.hpp:238
#define hilet
Invariant should be the default for variables.
Definition utility.hpp:23
@ read
Allow read access to a file.
@ write
Allow write access to a file.
DOXYGEN BUG.
Definition algorithm.hpp:13
geometry/margins.hpp
Definition cache.hpp:11
Character encoder/decoder template.
Definition char_converter.hpp:83