]> granicus.if.org Git - python/commitdiff
When LINEAR_PROBES=0, let the compiler remove the dead code on its own.
authorRaymond Hettinger <python@rcn.com>
Sat, 21 Sep 2013 21:07:18 +0000 (14:07 -0700)
committerRaymond Hettinger <python@rcn.com>
Sat, 21 Sep 2013 21:07:18 +0000 (14:07 -0700)
Objects/setobject.c

index 05b672fbec59cafeb8e2e21357836f0833af33ee..017fcd88db3ad75d91eacae280bc176d8a1ce9f6 100644 (file)
@@ -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;
     }