From: Victor Stinner Date: Wed, 12 Oct 2011 23:12:01 +0000 (+0200) Subject: Simplify PyUnicode_MAX_CHAR_VALUE X-Git-Tag: v3.3.0a1~1186 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8813104e5340ca4f1a6988b33cc551e009bae16b;p=python Simplify PyUnicode_MAX_CHAR_VALUE Use PyUnicode_IS_ASCII instead of PyUnicode_IS_COMPACT_ASCII, so the following test can be removed: PyUnicode_DATA(op) == (((PyCompactUnicodeObject *)(op))->utf8) --- diff --git a/Include/unicodeobject.h b/Include/unicodeobject.h index 8fbad0999e..524ce8ab9a 100644 --- a/Include/unicodeobject.h +++ b/Include/unicodeobject.h @@ -548,14 +548,13 @@ enum PyUnicode_Kind { than iterating over the string. */ #define PyUnicode_MAX_CHAR_VALUE(op) \ (assert(PyUnicode_IS_READY(op)), \ - (PyUnicode_IS_COMPACT_ASCII(op) ? 0x7f: \ + (PyUnicode_IS_ASCII(op) ? \ + (0x7f) : \ (PyUnicode_KIND(op) == PyUnicode_1BYTE_KIND ? \ - (PyUnicode_DATA(op) == (((PyCompactUnicodeObject *)(op))->utf8) ? \ - (0x7fU) : (0xffU) \ - ) : \ + (0xffU) : \ (PyUnicode_KIND(op) == PyUnicode_2BYTE_KIND ? \ - (0xffffU) : (0x10ffffU) \ - )))) + (0xffffU) : \ + (0x10ffffU))))) #endif