From: Lucas Bajolet Date: Tue, 8 Dec 2015 18:20:43 +0000 (-0500) Subject: lib/core: Added shortcut for common ASCII-case in `find_beginning_of_char_at` X-Git-Tag: v0.8~18^2~6 X-Git-Url: http://nitlanguage.org lib/core: Added shortcut for common ASCII-case in `find_beginning_of_char_at` Signed-off-by: Lucas Bajolet --- diff --git a/lib/core/text/native.nit b/lib/core/text/native.nit index fad3ae1..a8bbc4b 100644 --- a/lib/core/text/native.nit +++ b/lib/core/text/native.nit @@ -238,6 +238,7 @@ extern class NativeString `{ char* `} fun find_beginning_of_char_at(pos: Int): Int do var endpos = pos var c = self[pos] + if c & 0x80u8 == 0x00u8 then return pos while c & 0xC0u8 == 0x80u8 do pos -= 1 c = self[pos]