Ezio Melotti ezio.melo...@gmail.com added the comment:
#10542 proposes the following macros to factor out common code:
#define _Py_UNICODE_ISSURROGATE
#define _Py_UNICODE_ISHIGHSURROGATE
#define _Py_UNICODE_ISLOWSURROGATE
#define _Py_UNICODE_JOIN_SURROGATES
and to avoid checking for
Marc-Andre Lemburg m...@egenix.com added the comment:
Ezio Melotti wrote:
Ezio Melotti ezio.melo...@gmail.com added the comment:
#10542 proposes the following macros to factor out common code:
#define _Py_UNICODE_ISSURROGATE
#define _Py_UNICODE_ISHIGHSURROGATE
#define
Changes by Benjamin Peterson benja...@python.org:
--
resolution: - duplicate
status: open - closed
superseder: - Py_UNICODE_NEXT and other macros for surrogates
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue12751
New submission from STINNER Victor victor.stin...@haypocalc.com:
A lot of code is duplicated in unicodeobject.c to manipulate (encode/decode)
surrogates. Each function has from one to three different implementations. The
new decode_ucs4() function adds a new implementation. Attached patch
STINNER Victor victor.stin...@haypocalc.com added the comment:
We may use the following unlikely macro for IS_SURROGATE, IS_HIGH_SURROGATE and
IS_LOW_SURROGATE:
#define likely(x) __builtin_expect(!!(x), 1)
#define unlikely(x) __builtin_expect(!!(x), 0)
I suppose that we should use
Ezio Melotti ezio.melo...@gmail.com added the comment:
This has been proposed already in #10542 (the issue also has patches).
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue12751
___
Antoine Pitrou pit...@free.fr added the comment:
HIGH_SURROGATE and LOW_SURROGATE require that their ordinal argument
has been preproceed to fit in [0; 0x]. I added this requirement in
the comment of these macros.
The macros should preprocess the argument themselves. It will make the
Changes by STINNER Victor victor.stin...@haypocalc.com:
--
nosy: +belopolsky
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue12751
___
___
STINNER Victor victor.stin...@haypocalc.com added the comment:
This has been proposed already in #10542 (the issue also has patches).
The two issues are different: this issue is only a refactoring, whereas #10542
adds a new feature (function/macro: Py_UNICODE_NEXT).
--