summaryrefslogtreecommitdiffstats
path: root/Include
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@haypocalc.com>2011-10-12 23:12:01 (GMT)
committerVictor Stinner <victor.stinner@haypocalc.com>2011-10-12 23:12:01 (GMT)
commit8813104e5340ca4f1a6988b33cc551e009bae16b (patch)
tree2fe0c3ca4aefcd30dcb8c700934e3e0023dec76e /Include
parent9e7a1bcfd6737de148dd99c953e1d079ad3f239a (diff)
downloadcpython-8813104e5340ca4f1a6988b33cc551e009bae16b.zip
cpython-8813104e5340ca4f1a6988b33cc551e009bae16b.tar.gz
cpython-8813104e5340ca4f1a6988b33cc551e009bae16b.tar.bz2
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)
Diffstat (limited to 'Include')
-rw-r--r--Include/unicodeobject.h11
1 files changed, 5 insertions, 6 deletions
diff --git a/Include/unicodeobject.h b/Include/unicodeobject.h
index 8fbad09..524ce8a 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