From: Stefan Behnel Date: Sat, 5 Feb 2011 16:16:06 +0000 (+0100) Subject: fix surrogate pair calculation X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=85d716c5948a7be7cfbe59c96bc7ad2ed34226dd;p=cython.git fix surrogate pair calculation --- diff --git a/Cython/Compiler/PyrexTypes.py b/Cython/Compiler/PyrexTypes.py index 07142349..6ed25191 100755 --- a/Cython/Compiler/PyrexTypes.py +++ b/Cython/Compiler/PyrexTypes.py @@ -965,7 +965,7 @@ static CYTHON_INLINE Py_UCS4 __Pyx_PyObject_AsPy_UCS4(PyObject* x) { if (high_val >= 0xD800 && high_val <= 0xDBFF) { Py_UCS4 low_val = PyUnicode_AS_UNICODE(x)[1]; if (low_val >= 0xDC00 && low_val <= 0xDFFF) { - return 0x10000 | ((high_val & ((1<<10)-1)) << 10) | (low_val & ((1<<10)-1)); + return 0x10000 + (((high_val & ((1<<10)-1)) << 10) | (low_val & ((1<<10)-1))); } } }