[Python-checkins] cpython: Minor touchups.

raymond.hettinger python-checkins at python.org
Tue Sep 3 01:32:34 CEST 2013


http://hg.python.org/cpython/rev/035c062af722
changeset:   85503:035c062af722
user:        Raymond Hettinger <python at rcn.com>
date:        Mon Sep 02 16:32:27 2013 -0700
summary:
  Minor touchups.

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


diff --git a/Objects/setobject.c b/Objects/setobject.c
--- a/Objects/setobject.c
+++ b/Objects/setobject.c
@@ -11,8 +11,10 @@
 #include "structmember.h"
 #include "stringlib/eq.h"
 
-/* This must be >= 1. */
+/* This must be >= 1 */
 #define PERTURB_SHIFT 5
+
+/* This should be >= PySet_MINSIZE - 1 */
 #define LINEAR_PROBES 9
 
 /* Object used as dummy key to fill deleted entries */
@@ -123,7 +125,7 @@
         }
 
         perturb >>= PERTURB_SHIFT;
-        i = i * 5 + perturb + 1;
+        i = i * 5 + 1 + perturb;
 
         entry = &table[i & mask];
         if (entry->key == NULL)
@@ -187,7 +189,7 @@
         }
 
         perturb >>= PERTURB_SHIFT;
-        i = i * 5 + perturb + 1;
+        i = i * 5 + 1 + perturb;
 
         entry = &table[i & mask];
         if (entry->key == NULL)
@@ -257,7 +259,7 @@
                 goto found_null;
         }
         perturb >>= PERTURB_SHIFT;
-        i = i * 5 + perturb + 1;
+        i = i * 5 + 1 + perturb;
     }
   found_null:
     so->fill++;

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


More information about the Python-checkins mailing list