pike.git/
src/
builtin_functions.c
Branch:
Tag:
Non-build tags
All tags
No tags
2013-05-17
2013-05-17 17:49:55 by Arne Goedeke <el@laramies.com>
52b5d9c2c026825e6f385ffa8b1ad0fb081c301f (
10
lines) (+
6
/-
4
)
[
Show
|
Annotate
]
Branch:
7.9
string_to_utf8: use macros to access string. much faster for long 7bit
strings
1949:
struct pike_string *out; ptrdiff_t i,j; INT_TYPE extended = 0;
+
PCHARP src;
get_all_args("string_to_utf8", args, "%W.%i", &in, &extended); len = in->len;
-
for(i=0; i < in->len; i++) {
-
unsigned INT32 c =
index
_
shared_string
(
in, i
);
+
for(i=0
,src=MKPCHARP_STR(in)
; i < in->len;
INC_PCHARP(src,1),
i++) {
+
unsigned INT32 c =
EXTRACT
_
PCHARP
(
src
);
if (c & ~0x7f) { /* 8bit or more. */ len++;
2001:
} out = begin_shared_string(len);
-
for(i=j=0; i < in->len; i++) {
-
unsigned INT32 c =
index
_
shared_string
(
in, i
);
+
for(i=j=0
,src=MKPCHARP_STR(in)
; i < in->len;
INC_PCHARP(src,1),
i++) {
+
unsigned INT32 c =
EXTRACT
_
PCHARP
(
src
);
if (!(c & ~0x7f)) { /* 7bit */ out->str[j++] = c;