nitlanguage
/
nit.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
5e791a9
)
text/flat: faster NativeString::set_char_at
author
Jean Privat
<jean@pryen.org>
Fri, 4 Mar 2016 02:38:34 +0000
(21:38 -0500)
committer
Jean Privat
<jean@pryen.org>
Fri, 4 Mar 2016 02:59:15 +0000
(21:59 -0500)
Signed-off-by: Jean Privat <jean@pryen.org>
lib/core/text/flat.nit
patch
|
blob
|
history
diff --git
a/lib/core/text/flat.nit
b/lib/core/text/flat.nit
index
47b8608
..
30af53b
100644
(file)
--- a/
lib/core/text/flat.nit
+++ b/
lib/core/text/flat.nit
@@
-1250,6
+1250,10
@@
redef class NativeString
#
# Very unsafe, make sure to have room for this char prior to calling this function.
private fun set_char_at(pos: Int, c: Char) do
+ if c.code_point < 128 then
+ self[pos] = c.code_point.to_b
+ return
+ end
var ln = c.u8char_len
native_set_char(pos, c, ln)
end