Mercurial > cpython-lru_cache-weakref
diff Include/unicodeobject.h @ 77448:acca141fda80
Issue #15026: utf-16 encoding is now significantly faster (up to 10x).
Patch by Serhiy Storchaka.
| author | Antoine Pitrou <solipsis@pitrou.net> |
|---|---|
| date | Fri, 15 Jun 2012 22:15:23 +0200 |
| parents | 09736ae1c314 |
| children | a1aa13ef00c5 5e0a1f116521 |
line wrap: on
line diff
--- a/Include/unicodeobject.h Fri Jun 15 20:08:29 2012 +0100 +++ b/Include/unicodeobject.h Fri Jun 15 22:15:23 2012 +0200 @@ -188,9 +188,9 @@ (((((Py_UCS4)(high) & 0x03FF) << 10) | \ ((Py_UCS4)(low) & 0x03FF)) + 0x10000) /* high surrogate = top 10 bits added to D800 */ -#define Py_UNICODE_HIGH_SURROGATE(ch) (0xD800 | (((ch) - 0x10000) >> 10)) +#define Py_UNICODE_HIGH_SURROGATE(ch) (0xD800 - (0x10000 >> 10) + ((ch) >> 10)) /* low surrogate = bottom 10 bits added to DC00 */ -#define Py_UNICODE_LOW_SURROGATE(ch) (0xDC00 | (((ch) - 0x10000) & 0x3FF)) +#define Py_UNICODE_LOW_SURROGATE(ch) (0xDC00 + ((ch) & 0x3FF)) /* Check if substring matches at given offset. The offset must be valid, and the substring must not be empty. */
