[Python-Dev] Rename PyUnicode_KIND_SIZE ? (original) (raw)
Victor Stinner victor.stinner at haypocalc.com
Thu Oct 6 17:52:05 CEST 2011
- Previous message: [Python-Dev] Rename PyUnicode_KIND_SIZE ?
- Next message: [Python-Dev] Rename PyUnicode_KIND_SIZE ?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Le 06/10/2011 15:52, Antoine Pitrou a écrit :
The PyUnicodeKINDSIZE macro is defined as follows. Its name looks rather mysterious or misleading to me. Could we rename it to something else?
What do you propose?
also, is it useful?
index << (kind - 1) and index * PyUnicode_CHARACTER_SIZE(str) were used in unicodeobject.c. It's not easy to understand this formula, and it heavily depend on how kind is defined. I wrote a patch to use enum for kind using different values, but the gain was minor so I didn't commit it.
We may move it to unicodeobject.c. index * PyUnicode_CHARACTER_SIZE(str) is enough for the public API.
(PyUnicode_KIND_SIZE() is also a micro-optimization, it uses shift instead of multiply.)
PEP 393 has added a flurry of new macros to unicodeobject.h and it's getting hard to know which ones are genuinely useful, or well-performing)
Yes, we have to review new functions and macros.
Victor
- Previous message: [Python-Dev] Rename PyUnicode_KIND_SIZE ?
- Next message: [Python-Dev] Rename PyUnicode_KIND_SIZE ?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]