From 99d7ad0bb0b38eb979a0442705e5c9efcd55e8e0 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Wed, 22 Feb 2012 13:37:39 +0100 Subject: Micro-optimize computation of maxchar in PyUnicode_TransformDecimalToASCII() --- Objects/unicodeobject.c | 4 ++-- 1 file 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 */ -- cgit v0.12