[Python-checkins] cpython: Minor tweek. Counting down rather than up reduces register pressure.

raymond.hettinger python-checkins at python.org
Tue Dec 15 03:42:36 EST 2015


https://hg.python.org/cpython/rev/4181afce4fbd
changeset:   99579:4181afce4fbd
user:        Raymond Hettinger <python at rcn.com>
date:        Tue Dec 15 00:42:30 2015 -0800
summary:
  Minor tweek.  Counting down rather than up reduces register pressure.

files:
  Objects/setobject.c |  2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)


diff --git a/Objects/setobject.c b/Objects/setobject.c
--- a/Objects/setobject.c
+++ b/Objects/setobject.c
@@ -678,7 +678,7 @@
         size_t newmask = (size_t)so->mask;
         so->fill = other->used;
         so->used = other->used;
-        for (i = 0; i <= other->mask; i++, other_entry++) {
+        for (i = other->mask + 1; i > 0 ; i--, other_entry++) {
             key = other_entry->key;
             if (key != NULL && key != dummy) {
                 Py_INCREF(key);

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list