[Python-checkins] cpython: When LINEAR_PROBES=0, let the compiler remove the dead code on its own.
raymond.hettinger
python-checkins at python.org
Sat Sep 21 23:07:30 CEST 2013
http://hg.python.org/cpython/rev/964bcd10b536
changeset: 85766:964bcd10b536
user: Raymond Hettinger <python at rcn.com>
date: Sat Sep 21 14:07:18 2013 -0700
summary:
When LINEAR_PROBES=0, let the compiler remove the dead code on its own.
files:
Objects/setobject.c | 12 ------------
1 files changed, 0 insertions(+), 12 deletions(-)
diff --git a/Objects/setobject.c b/Objects/setobject.c
--- a/Objects/setobject.c
+++ b/Objects/setobject.c
@@ -61,9 +61,7 @@
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 @@
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 @@
if (entry->key == dummy && freeslot == NULL)
freeslot = entry;
}
-#endif
perturb >>= PERTURB_SHIFT;
i = i * 5 + 1 + perturb;
@@ -136,9 +132,7 @@
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 @@
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 @@
if (entry->key == dummy && freeslot == NULL)
freeslot = entry;
}
-#endif
perturb >>= PERTURB_SHIFT;
i = i * 5 + 1 + perturb;
@@ -204,21 +196,17 @@
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;
}
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list