summaryrefslogtreecommitdiff
path: root/src/utf8.hh
diff options
context:
space:
mode:
authorMaxime Coste <frrrwww@gmail.com>2016-07-15 19:57:11 +0100
committerMaxime Coste <frrrwww@gmail.com>2016-07-15 20:07:47 +0100
commit73fdc726fbdf60c22cd7db06ef95cdb0312d2e7e (patch)
tree193b8eb7e639c5be517ef6662a04c744b9c095bf /src/utf8.hh
parent4ecdbea5c481ae1b4c1c3daad77c4b795b624f40 (diff)
Avoid postfix increment in utf8::distance
Diffstat (limited to 'src/utf8.hh')
-rw-r--r--src/utf8.hh3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/utf8.hh b/src/utf8.hh
index 648c6011..85200dc7 100644
--- a/src/utf8.hh
+++ b/src/utf8.hh
@@ -67,6 +67,7 @@ Iterator advance(Iterator it, const Iterator& end, CharCount d)
// return true if it points to the first byte of a (either single or
// multibyte) character
+[[gnu::always_inline]]
inline bool is_character_start(char c)
{
return (c & 0xC0) != 0x80;
@@ -80,7 +81,7 @@ CharCount distance(Iterator begin, const Iterator& end)
while (begin != end)
{
- if (is_character_start(*begin++))
+ if (is_character_start(read(begin)))
++dist;
}
return dist;