Commit 99d7ad0b authored by Victor Stinner's avatar Victor Stinner

Micro-optimize computation of maxchar in PyUnicode_TransformDecimalToASCII()

parent da79e632
...@@ -8929,15 +8929,15 @@ PyUnicode_TransformDecimalToASCII(Py_UNICODE *s, ...@@ -8929,15 +8929,15 @@ PyUnicode_TransformDecimalToASCII(Py_UNICODE *s,
enum PyUnicode_Kind kind; enum PyUnicode_Kind kind;
void *data; void *data;
maxchar = 0; maxchar = 127;
for (i = 0; i < length; i++) { for (i = 0; i < length; i++) {
Py_UNICODE ch = s[i]; Py_UNICODE ch = s[i];
if (ch > 127) { if (ch > 127) {
int decimal = Py_UNICODE_TODECIMAL(ch); int decimal = Py_UNICODE_TODECIMAL(ch);
if (decimal >= 0) if (decimal >= 0)
ch = '0' + decimal; ch = '0' + decimal;
maxchar = Py_MAX(maxchar, ch);
} }
maxchar = Py_MAX(maxchar, ch);
} }
/* Copy to a new string */ /* Copy to a new string */
......
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