summaryrefslogtreecommitdiffstats
path: root/Objects/setobject.c
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2013-09-02 23:32:27 (GMT)
committerRaymond Hettinger <python@rcn.com>2013-09-02 23:32:27 (GMT)
commitc56e0e39803cbaf0211cedcee4c13e47dfe6f6f9 (patch)
tree5db5e966a2e0fbbb72da1b1eee52659619e870bc /Objects/setobject.c
parent69492dab07772f71aa226cbafa03f7d50309dd43 (diff)
downloadcpython-c56e0e39803cbaf0211cedcee4c13e47dfe6f6f9.zip
cpython-c56e0e39803cbaf0211cedcee4c13e47dfe6f6f9.tar.gz
cpython-c56e0e39803cbaf0211cedcee4c13e47dfe6f6f9.tar.bz2
Minor touchups.
Diffstat (limited to 'Objects/setobject.c')
-rw-r--r--Objects/setobject.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/Objects/setobject.c b/Objects/setobject.c
index 524bda9..0aec100 100644
--- 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 @@ set_lookkey(PySetObject *so, PyObject *key, Py_hash_t hash)
}
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 @@ set_lookkey_unicode(PySetObject *so, PyObject *key, Py_hash_t hash)
}
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 @@ set_insert_clean(PySetObject *so, PyObject *key, Py_hash_t hash)
goto found_null;
}
perturb >>= PERTURB_SHIFT;
- i = i * 5 + perturb + 1;
+ i = i * 5 + 1 + perturb;
}
found_null:
so->fill++;