From b20ae029aaae181a06118962a5a9a4c997b68ace Mon Sep 17 00:00:00 2001 From: Lucas Bajolet Date: Tue, 8 Dec 2015 13:20:43 -0500 Subject: [PATCH] lib/core: Added shortcut for common ASCII-case in `find_beginning_of_char_at` Signed-off-by: Lucas Bajolet --- lib/core/text/native.nit | 1 + 1 file changed, 1 insertion(+) 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] -- 1.7.9.5