From 73fdc726fbdf60c22cd7db06ef95cdb0312d2e7e Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Fri, 15 Jul 2016 19:57:11 +0100 Subject: [PATCH] Avoid postfix increment in utf8::distance --- src/utf8.hh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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;