Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 0ce1953

Browse files
committed
When LINEAR_PROBES=0, let the compiler remove the dead code on its own.
1 parent c70a2b7 commit 0ce1953

1 file changed

Lines changed: 0 additions & 12 deletions

File tree

Objects/setobject.c

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,7 @@ set_lookkey(PySetObject *so, PyObject *key, Py_hash_t hash)
6161
size_t mask = so->mask;
6262
size_t i = (size_t)hash; /* Unsigned for defined overflow behavior. */
6363
int cmp;
64-
#if LINEAR_PROBES
6564
size_t j;
66-
#endif
6765

6866
entry = &table[i & mask];
6967
if (entry->key == NULL)
@@ -87,7 +85,6 @@ set_lookkey(PySetObject *so, PyObject *key, Py_hash_t hash)
8785
if (entry->key == dummy && freeslot == NULL)
8886
freeslot = entry;
8987

90-
#if LINEAR_PROBES
9188
for (j = 1 ; j <= LINEAR_PROBES ; j++) {
9289
entry = &table[(i + j) & mask];
9390
if (entry->key == NULL)
@@ -109,7 +106,6 @@ set_lookkey(PySetObject *so, PyObject *key, Py_hash_t hash)
109106
if (entry->key == dummy && freeslot == NULL)
110107
freeslot = entry;
111108
}
112-
#endif
113109

114110
perturb >>= PERTURB_SHIFT;
115111
i = i * 5 + 1 + perturb;
@@ -136,9 +132,7 @@ set_lookkey_unicode(PySetObject *so, PyObject *key, Py_hash_t hash)
136132
size_t perturb = hash;
137133
size_t mask = so->mask;
138134
size_t i = (size_t)hash;
139-
#if LINEAR_PROBES
140135
size_t j;
141-
#endif
142136

143137
/* Make sure this function doesn't have to handle non-unicode keys,
144138
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)
162156
if (entry->key == dummy && freeslot == NULL)
163157
freeslot = entry;
164158

165-
#if LINEAR_PROBES
166159
for (j = 1 ; j <= LINEAR_PROBES ; j++) {
167160
entry = &table[(i + j) & mask];
168161
if (entry->key == NULL)
@@ -175,7 +168,6 @@ set_lookkey_unicode(PySetObject *so, PyObject *key, Py_hash_t hash)
175168
if (entry->key == dummy && freeslot == NULL)
176169
freeslot = entry;
177170
}
178-
#endif
179171

180172
perturb >>= PERTURB_SHIFT;
181173
i = i * 5 + 1 + perturb;
@@ -204,21 +196,17 @@ set_insert_clean(PySetObject *so, PyObject *key, Py_hash_t hash)
204196
size_t perturb = hash;
205197
size_t mask = (size_t)so->mask;
206198
size_t i = (size_t)hash;
207-
#if LINEAR_PROBES
208199
size_t j;
209-
#endif
210200

211201
while (1) {
212202
entry = &table[i & mask];
213203
if (entry->key == NULL)
214204
goto found_null;
215-
#if LINEAR_PROBES
216205
for (j = 1 ; j <= LINEAR_PROBES ; j++) {
217206
entry = &table[(i + j) & mask];
218207
if (entry->key == NULL)
219208
goto found_null;
220209
}
221-
#endif
222210
perturb >>= PERTURB_SHIFT;
223211
i = i * 5 + 1 + perturb;
224212
}

0 commit comments

Comments
 (0)