lib/core: Added shortcut for common ASCII-case in `find_beginning_of_char_at`
authorLucas Bajolet <r4pass@hotmail.com>
Tue, 8 Dec 2015 18:20:43 +0000 (13:20 -0500)
committerLucas Bajolet <r4pass@hotmail.com>
Tue, 29 Dec 2015 04:49:28 +0000 (23:49 -0500)
Signed-off-by: Lucas Bajolet <r4pass@hotmail.com>

lib/core/text/native.nit

index fad3ae1..a8bbc4b 100644 (file)
@@ -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]