[Python-checkins] cpython: Micro-optimize computation of maxchar in PyUnicode_TransformDecimalToASCII()

victor.stinner python-checkins at python.org
Wed Feb 22 13:58:44 CET 2012


http://hg.python.org/cpython/rev/82acb284fc5e
changeset: 75172:82acb284fc5e
user: Victor Stinner <vstinner at wyplay.com>
date: Wed Feb 22 13:37:39 2012 +0100
summary:
 Micro-optimize computation of maxchar in PyUnicode_TransformDecimalToASCII()
files:
 Objects/unicodeobject.c | 6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -8929,15 +8929,15 @@
 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 */
-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /