summaryrefslogtreecommitdiffstats
path: root/generic/tclUtf.c
diff options
context:
space:
mode:
authordkf <dkf@noemail.net>2002-05-29 10:35:33 (GMT)
committerdkf <dkf@noemail.net>2002-05-29 10:35:33 (GMT)
commite5204b46c22cfe0928cc995d77c44fe21536f8ee (patch)
tree69690c28d7ea044538f1557ec58740707718d328 /generic/tclUtf.c
parente1b7a8e6408ffe349b594612073aeee96b481c29 (diff)
downloadtcl-e5204b46c22cfe0928cc995d77c44fe21536f8ee.zip
tcl-e5204b46c22cfe0928cc995d77c44fe21536f8ee.tar.gz
tcl-e5204b46c22cfe0928cc995d77c44fe21536f8ee.tar.bz2
Made Tcl_UniCharNcmp faster on big-endian machines; the system memcmp()is
probably optimized far in excess of anything we could do! Little-endian just use the old code... FossilOrigin-Name: b3535ea3919b47c72ac881fe7096124210b2d529
Diffstat (limited to 'generic/tclUtf.c')
-rw-r--r--generic/tclUtf.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/generic/tclUtf.c b/generic/tclUtf.c
index 56dcaca..667bb6d 100644
--- a/generic/tclUtf.c
+++ b/generic/tclUtf.c
@@ -8,7 +8,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclUtf.c,v 1.24 2002/05/29 09:09:57 hobbs Exp $
+ * RCS: @(#) $Id: tclUtf.c,v 1.25 2002/05/29 10:35:46 dkf Exp $
*/
#include "tclInt.h"
@@ -1351,16 +1351,23 @@ Tcl_UniCharNcmp(cs, ct, n)
CONST Tcl_UniChar *ct; /* Unicode string cs is compared to. */
unsigned long n; /* Number of unichars to compare. */
{
+#ifdef TCL_OPTIMIZE_UNICODE_COMPARE
/*
- * We can't simply call 'memcmp(cs, ct, n*sizeof(Tcl_UniChar));'
- * because that may not be lexically correct.
+ * We are definitely on a big-endian machine; memcmp() is safe
*/
- for ( ; n != 0; n--, cs++, ct++) {
+ return memcmp(cs, ct, n*sizeof(Tcl_UniChar));
+
+#else /* !TCL_OPTIMIZE_UNICODE_COMPARE */
+ /*
+ * We can't simply call memcmp() because that is not lexically correct.
+ */
+ for ( ; n != 0; cs++, ct++, n--) {
if (*cs != *ct) {
return (*cs - *ct);
}
}
return 0;
+#endif /* TCL_OPTIMIZE_UNICODE_COMPARE */
}
/*