summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@wyplay.com>2012-02-22 12:37:39 (GMT)
committerVictor Stinner <vstinner@wyplay.com>2012-02-22 12:37:39 (GMT)
commit99d7ad0bb0b38eb979a0442705e5c9efcd55e8e0 (patch)
treec4a657581fd69b4bed8a8b676ed3eebf5f8285b4 /Objects
parentda79e632c45ad1a403317c08d9fb309130cb3e7e (diff)
downloadcpython-99d7ad0bb0b38eb979a0442705e5c9efcd55e8e0.zip
cpython-99d7ad0bb0b38eb979a0442705e5c9efcd55e8e0.tar.gz
cpython-99d7ad0bb0b38eb979a0442705e5c9efcd55e8e0.tar.bz2
Micro-optimize computation of maxchar in PyUnicode_TransformDecimalToASCII()
Diffstat (limited to 'Objects')
-rw-r--r--Objects/unicodeobject.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
index c871420..35aa79f 100644
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -8929,15 +8929,15 @@ PyUnicode_TransformDecimalToASCII(Py_UNICODE *s,
enum PyUnicode_Kind kind;
void *data;
- maxchar = 0;
+ maxchar = 127;
for (i = 0; i < length; i++) {
Py_UNICODE ch = s[i];
if (ch > 127) {
int decimal = Py_UNICODE_TODECIMAL(ch);
if (decimal >= 0)
ch = '0' + decimal;
+ maxchar = Py_MAX(maxchar, ch);
}
- maxchar = Py_MAX(maxchar, ch);
}
/* Copy to a new string */