52 return __builtin_clz((
unsigned char)(~c)) - (
sizeof(
unsigned int) * 8 - 8);
58 unsigned long c = (uint8_t)*
begin;
60 if (byte_count == 1) {
64 unsigned long result = c & ~(0xffu << (8 - byte_count));
66 for (
size_t i = 1; i < byte_count; ++i) {
68 result |= *
begin & 0x3f;
109 if ((*pos & 0xc0) == 0x80)
return false;
112 if (
end_ - pos < byte_count)
return false;
124 static_assert(std::is_same<std::remove_reference_t<
decltype(*begin_)>,
const char>::value,
125 "Iterator must dereference to const char");
127 std::is_convertible<std::remove_reference_t<
decltype(
end_ -
begin_)>,
size_t>::value,
128 "Iterator arithmetic must evaluate to something that is convertible to size_t");
Definition: utf8range.h:75
CharIterator begin_
Definition: utf8range.h:76
bool operator!=(const Iter &rhs) const
Definition: utf8range.h:97
Iter(CharIterator begin)
Definition: utf8range.h:80
CharIterator operator*() const
Definition: utf8range.h:86
Iter operator++(int)
Definition: utf8range.h:91
Iter & operator=(const Iter &rhs)
Definition: utf8range.h:82
Iter & operator++()
Definition: utf8range.h:87
Iter(const Iter &rhs)
Definition: utf8range.h:81
bool operator==(const Iter &rhs) const
Definition: utf8range.h:96
unsigned long codePoint() const
Definition: utf8range.h:98
Iter()
Definition: utf8range.h:79
Definition: utf8range.h:30
UTF8Range(const UTF8Range &)=default
UTF8Range & operator=(UTF8Range &&)=default
bool verify()
Definition: utf8range.h:106
static unsigned long codePoint(CharIterator begin)
Definition: utf8range.h:57
UTF8Range & operator=(const UTF8Range &)=default
Iter end() const
Definition: utf8range.h:101
UTF8Range(UTF8Range &&)=default
UTF8Range()
Definition: utf8range.h:33
CharIterator end_
Definition: utf8range.h:123
static size_t byteCount(char c)
Definition: utf8range.h:44
CharIterator begin_
Definition: utf8range.h:122
Iter begin() const
Definition: utf8range.h:100
UTF8Range(CharIterator begin, CharIterator end)
Definition: utf8range.h:32