Author: tridge Date: 2004-10-11 02:10:45 +0000 (Mon, 11 Oct 2004) New Revision: 2902
WebSVN: http://websvn.samba.org/websvn/changeset.php?rep=samba&path=/branches/SAMBA_4_0/source/lib&rev=2902&nolog=1 Log: make toupper_w() and tolower_w() slightly faster by putting the most common conditions first Modified: branches/SAMBA_4_0/source/lib/util_unistr.c Changeset: Modified: branches/SAMBA_4_0/source/lib/util_unistr.c =================================================================== --- branches/SAMBA_4_0/source/lib/util_unistr.c 2004-10-11 02:07:30 UTC (rev 2901) +++ branches/SAMBA_4_0/source/lib/util_unistr.c 2004-10-11 02:10:45 UTC (rev 2902) @@ -54,16 +54,16 @@ ********************************************************************/ codepoint_t toupper_w(codepoint_t val) { - if (val & 0xFFFF0000) { - return val; - } if (val < 128) { return toupper(val); } + if (upcase_table == (void *)-1) { + return val; + } if (upcase_table == NULL) { load_case_tables(); } - if (upcase_table == (void *)-1) { + if (val & 0xFFFF0000) { return val; } return SVAL(upcase_table, val*2); @@ -74,16 +74,16 @@ ********************************************************************/ codepoint_t tolower_w(codepoint_t val) { - if (val & 0xFFFF0000) { - return val; - } if (val < 128) { return tolower(val); } + if (lowcase_table == (void *)-1) { + return val; + } if (lowcase_table == NULL) { load_case_tables(); } - if (lowcase_table == (void *)-1) { + if (val & 0xFFFF0000) { return val; } return SVAL(lowcase_table, val*2);