diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2011-10-13 15:58:11 (GMT) |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2011-10-13 15:58:11 (GMT) |
commit | dda339e6d22778f5c4bdeb6f588d341ce131acbb (patch) | |
tree | 881a69450a7e47a2d9c14b07ad1efbfa10ef5fa8 /Objects/stringlib | |
parent | 72d6a13413d3dedf9979cfbd7bc41d58f52144b6 (diff) | |
download | cpython-dda339e6d22778f5c4bdeb6f588d341ce131acbb.zip cpython-dda339e6d22778f5c4bdeb6f588d341ce131acbb.tar.gz cpython-dda339e6d22778f5c4bdeb6f588d341ce131acbb.tar.bz2 |
Simplify heuristic for when to use memchr
Diffstat (limited to 'Objects/stringlib')
-rw-r--r-- | Objects/stringlib/fastsearch.h | 12 |
1 files changed, 1 insertions, 11 deletions
diff --git a/Objects/stringlib/fastsearch.h b/Objects/stringlib/fastsearch.h index 085ec6a..0f7aea7 100644 --- a/Objects/stringlib/fastsearch.h +++ b/Objects/stringlib/fastsearch.h @@ -113,20 +113,10 @@ FASTSEARCH(const STRINGLIB_CHAR* s, Py_ssize_t n, /* use memchr if we can choose a needle without two many likely false positives */ unsigned char needle; - int use_needle = 1; needle = p[0] & 0xff; #if STRINGLIB_SIZEOF_CHAR > 1 - if (needle == 0) { - needle = (p[0] >> 8) & 0xff; -#if STRINGLIB_SIZEOF_CHAR > 2 - if (needle == 0) - needle = (p[0] >> 16) & 0xff; + if (needle != 0) #endif - if (needle >= 32 || needle == 0) - use_needle = 0; - } -#endif - if (use_needle) return STRINGLIB(fastsearch_memchr_1char) (s, n, p[0], needle, maxcount, mode); } |