fix surrogate pair calculation
authorStefan Behnel <scoder@users.berlios.de>
Sat, 5 Feb 2011 16:16:06 +0000 (17:16 +0100)
committerStefan Behnel <scoder@users.berlios.de>
Sat, 5 Feb 2011 16:16:06 +0000 (17:16 +0100)
Cython/Compiler/PyrexTypes.py

index 07142349367bc1ba594a5a17c3e6bd106815a94f..6ed25191c00ed831ec1229be4a2f16181983478e 100755 (executable)
@@ -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)));
                }
            }
        }