1
0
mirror of https://github.com/samba-team/samba.git synced 2025-03-12 20:58:37 +03:00

r2902: make toupper_w() and tolower_w() slightly faster by putting the most common

conditions first
This commit is contained in:
Andrew Tridgell 2004-10-11 02:10:45 +00:00 committed by Gerald (Jerry) Carter
parent 994392d085
commit 878f6b565f

View File

@ -54,16 +54,16 @@ static void load_case_tables(void)
********************************************************************/ ********************************************************************/
codepoint_t toupper_w(codepoint_t val) codepoint_t toupper_w(codepoint_t val)
{ {
if (val & 0xFFFF0000) {
return val;
}
if (val < 128) { if (val < 128) {
return toupper(val); return toupper(val);
} }
if (upcase_table == (void *)-1) {
return val;
}
if (upcase_table == NULL) { if (upcase_table == NULL) {
load_case_tables(); load_case_tables();
} }
if (upcase_table == (void *)-1) { if (val & 0xFFFF0000) {
return val; return val;
} }
return SVAL(upcase_table, val*2); return SVAL(upcase_table, val*2);
@ -74,16 +74,16 @@ codepoint_t toupper_w(codepoint_t val)
********************************************************************/ ********************************************************************/
codepoint_t tolower_w(codepoint_t val) codepoint_t tolower_w(codepoint_t val)
{ {
if (val & 0xFFFF0000) {
return val;
}
if (val < 128) { if (val < 128) {
return tolower(val); return tolower(val);
} }
if (lowcase_table == (void *)-1) {
return val;
}
if (lowcase_table == NULL) { if (lowcase_table == NULL) {
load_case_tables(); load_case_tables();
} }
if (lowcase_table == (void *)-1) { if (val & 0xFFFF0000) {
return val; return val;
} }
return SVAL(lowcase_table, val*2); return SVAL(lowcase_table, val*2);