summaryrefslogtreecommitdiffstats
path: root/Objects/setobject.c
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2013-09-21 21:07:18 (GMT)
committerRaymond Hettinger <python@rcn.com>2013-09-21 21:07:18 (GMT)
commit0ce1953bf73dcf414e24213daa9e5b03584d795d (patch)
tree1843ff3026170730d4f6ca152cc2de8ec0060711 /Objects/setobject.c
parentc70a2b7bb90cac8fd65aaeaf62e36c0945b93243 (diff)
downloadcpython-0ce1953bf73dcf414e24213daa9e5b03584d795d.zip
cpython-0ce1953bf73dcf414e24213daa9e5b03584d795d.tar.gz
cpython-0ce1953bf73dcf414e24213daa9e5b03584d795d.tar.bz2
When LINEAR_PROBES=0, let the compiler remove the dead code on its own.
Diffstat (limited to 'Objects/setobject.c')
-rw-r--r--Objects/setobject.c12
1 files changed, 0 insertions, 12 deletions
diff --git a/Objects/setobject.c b/Objects/setobject.c
index 05b672f..017fcd8 100644
--- a/Objects/setobject.c
+++ b/Objects/setobject.c
@@ -61,9 +61,7 @@ set_lookkey(PySetObject *so, PyObject *key, Py_hash_t hash)
size_t mask = so->mask;
size_t i = (size_t)hash; /* Unsigned for defined overflow behavior. */
int cmp;
-#if LINEAR_PROBES
size_t j;
-#endif
entry = &table[i & mask];
if (entry->key == NULL)
@@ -87,7 +85,6 @@ set_lookkey(PySetObject *so, PyObject *key, Py_hash_t hash)
if (entry->key == dummy && freeslot == NULL)
freeslot = entry;
-#if LINEAR_PROBES
for (j = 1 ; j <= LINEAR_PROBES ; j++) {
entry = &table[(i + j) & mask];
if (entry->key == NULL)
@@ -109,7 +106,6 @@ set_lookkey(PySetObject *so, PyObject *key, Py_hash_t hash)
if (entry->key == dummy && freeslot == NULL)
freeslot = entry;
}
-#endif
perturb >>= PERTURB_SHIFT;
i = i * 5 + 1 + perturb;
@@ -136,9 +132,7 @@ set_lookkey_unicode(PySetObject *so, PyObject *key, Py_hash_t hash)
size_t perturb = hash;
size_t mask = so->mask;
size_t i = (size_t)hash;
-#if LINEAR_PROBES
size_t j;
-#endif
/* Make sure this function doesn't have to handle non-unicode keys,
including subclasses of str; e.g., one reason to subclass
@@ -162,7 +156,6 @@ set_lookkey_unicode(PySetObject *so, PyObject *key, Py_hash_t hash)
if (entry->key == dummy && freeslot == NULL)
freeslot = entry;
-#if LINEAR_PROBES
for (j = 1 ; j <= LINEAR_PROBES ; j++) {
entry = &table[(i + j) & mask];
if (entry->key == NULL)
@@ -175,7 +168,6 @@ set_lookkey_unicode(PySetObject *so, PyObject *key, Py_hash_t hash)
if (entry->key == dummy && freeslot == NULL)
freeslot = entry;
}
-#endif
perturb >>= PERTURB_SHIFT;
i = i * 5 + 1 + perturb;
@@ -204,21 +196,17 @@ set_insert_clean(PySetObject *so, PyObject *key, Py_hash_t hash)
size_t perturb = hash;
size_t mask = (size_t)so->mask;
size_t i = (size_t)hash;
-#if LINEAR_PROBES
size_t j;
-#endif
while (1) {
entry = &table[i & mask];
if (entry->key == NULL)
goto found_null;
-#if LINEAR_PROBES
for (j = 1 ; j <= LINEAR_PROBES ; j++) {
entry = &table[(i + j) & mask];
if (entry->key == NULL)
goto found_null;
}
-#endif
perturb >>= PERTURB_SHIFT;
i = i * 5 + 1 + perturb;
}