pike.git/
src/
builtin_functions.c
Branch:
Tag:
Non-build tags
All tags
No tags
2004-04-12
2004-04-12 00:27:38 by Per Hedbor <ph@opera.com>
bd662f26757bb690617ff3eb53761170f958954f (
17
lines) (+
11
/-
6
)
[
Show
|
Annotate
]
Branch:
7.9
five times faster lower and uppercase for 7bit characters.
Rev: src/builtin_functions.c:1.538
2:
|| This file is part of Pike. For copyright information see COPYRIGHT. || Pike is distributed under GPL, LGPL and MPL. See the file COPYING || for more information.
-
|| $Id: builtin_functions.c,v 1.
537
2004/04/
06
15
:
37
:
54
nilsson
Exp $
+
|| $Id: builtin_functions.c,v 1.
538
2004/04/
12
00
:
27
:
38
per
Exp $
*/ #include "global.h"
-
RCSID("$Id: builtin_functions.c,v 1.
537
2004/04/
06
15
:
37
:
54
nilsson
Exp $");
+
RCSID("$Id: builtin_functions.c,v 1.
538
2004/04/
12
00
:
27
:
38
per
Exp $");
#include "interpret.h" #include "svalue.h" #include "pike_macros.h"
407:
#define DO_LOWER_CASE(C) do {\ INT32 c = C; \ struct case_info *ci = find_ci(c); \
+
if(c<128){if(c >= 'A' && c <= 'Z' ) C=c+0x20;}else {\
if (ci) { \ switch(ci->mode) { \ case CIM_NONE: case CIM_LOWERDELTA: break; \
415:
case CIM_CASEBITOFF: C = ((c - ci->data) | ci->data) + ci->data; break; \ default: Pike_fatal("lower_case(): Unknown case_info mode: %d\n", ci->mode); \ } \
-
}
\
+
}}
\
} while(0) #define DO_LOWER_CASE_SHIFT0(C) do {\ INT32 c = C; \
-
+
if(c<128){if(c >= 'A' && c <= 'Z' ) C=c+0x20;}else {\
struct case_info *ci = find_ci_shift0(c); \ if (ci) { \ switch(ci->mode) { \
429:
case CIM_CASEBITOFF: C = ((c - ci->data) | ci->data) + ci->data; break; \ default: Pike_fatal("lower_case(): Unknown case_info mode: %d\n", ci->mode); \ } \
-
}
\
+
}}
\
} while(0) #define DO_UPPER_CASE(C) do {\ INT32 c = C; \
-
+
if(c<128){if(c >= 'a' && c <= 'z' ) C=c-0x20;}else {\
struct case_info *ci = find_ci(c); \ if (ci) { \ switch(ci->mode) { \
443:
case CIM_CASEBITOFF: C = ((c - ci->data)& ~ci->data) + ci->data; break; \ default: Pike_fatal("upper_case(): Unknown case_info mode: %d\n", ci->mode); \ } \
-
}
\
+
}}
\
} while(0) #define DO_UPPER_CASE_SHIFT0(C) do {\ INT32 c = C; \
-
+
if(c<128){if(c >= 'a' && c <= 'z' ) C=c-0x20;}else {\
struct case_info *ci = find_ci_shift0(c); \ if (ci) { \ switch(ci->mode) { \
457:
case CIM_CASEBITOFF: C = ((c - ci->data)& ~ci->data) + ci->data; break; \ default: Pike_fatal("lower_case(): Unknown case_info mode: %d\n", ci->mode); \ } \
-
}
\
+
}}
\
} while(0) /*! @decl string lower_case(string s)