summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarc-André Lemburg <mal@egenix.com>2000-06-18 22:22:27 (GMT)
committerMarc-André Lemburg <mal@egenix.com>2000-06-18 22:22:27 (GMT)
commit2f4d0e9bb6a1988b59274bd6db980b214fb17d23 (patch)
tree9133a6555eba99eca1f75352ca937cad6a014174
parente8d52af54bb90459d941ecdd683bc8416bc47b48 (diff)
downloadcpython-2f4d0e9bb6a1988b59274bd6db980b214fb17d23.zip
cpython-2f4d0e9bb6a1988b59274bd6db980b214fb17d23.tar.gz
cpython-2f4d0e9bb6a1988b59274bd6db980b214fb17d23.tar.bz2
Marc-Andre Lemburg <mal@lemburg.com>:
Added optimization proposed by Andrew Kuchling to the Unicode matching macro.
-rw-r--r--Include/unicodeobject.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/Include/unicodeobject.h b/Include/unicodeobject.h
index bed3b7b..967334a 100644
--- a/Include/unicodeobject.h
+++ b/Include/unicodeobject.h
@@ -168,7 +168,8 @@ typedef unsigned short Py_UNICODE;
while (0)
#define Py_UNICODE_MATCH(string, offset, substring)\
- (!memcmp((string)->str + (offset), (substring)->str,\
+ ((*((string)->str + (offset)) == *((substring)->str)) &&\
+ !memcmp((string)->str + (offset), (substring)->str,\
(substring)->length*sizeof(Py_UNICODE)))
#ifdef __cplusplus