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:
parent
994392d085
commit
878f6b565f
@ -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);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user