Kaydet (Commit) b066cc6a authored tarafından Victor Stinner's avatar Victor Stinner

Fix PyUnicode_CHARACTER_SIZE and PyUnicode_KIND_SIZE

üst 1d4bd25f
...@@ -441,7 +441,7 @@ PyAPI_DATA(PyTypeObject) PyUnicodeIter_Type; ...@@ -441,7 +441,7 @@ PyAPI_DATA(PyTypeObject) PyUnicodeIter_Type;
See also PyUnicode_KIND_SIZE(). */ See also PyUnicode_KIND_SIZE(). */
#define PyUnicode_CHARACTER_SIZE(op) \ #define PyUnicode_CHARACTER_SIZE(op) \
((Py_ssize_t) (1 << (PyUnicode_KIND(op) - 1))) (((Py_ssize_t)1 << (PyUnicode_KIND(op) - 1)))
/* Return pointers to the canonical representation cast to unsigned char, /* Return pointers to the canonical representation cast to unsigned char,
Py_UCS2, or Py_UCS4 for direct character access. Py_UCS2, or Py_UCS4 for direct character access.
...@@ -478,7 +478,7 @@ PyAPI_DATA(PyTypeObject) PyUnicodeIter_Type; ...@@ -478,7 +478,7 @@ PyAPI_DATA(PyTypeObject) PyUnicodeIter_Type;
See also PyUnicode_CHARACTER_SIZE(). */ See also PyUnicode_CHARACTER_SIZE(). */
#define PyUnicode_KIND_SIZE(kind, index) \ #define PyUnicode_KIND_SIZE(kind, index) \
((Py_ssize_t) ((index) << ((kind) - 1))) (((Py_ssize_t)(index)) << ((kind) - 1))
/* In the access macros below, "kind" may be evaluated more than once. /* In the access macros below, "kind" may be evaluated more than once.
All other macro parameters are evaluated exactly once, so it is safe All other macro parameters are evaluated exactly once, so it is safe
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment