summaryrefslogtreecommitdiffstats
path: root/Objects/setobject.c
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2015-01-19 05:25:15 (GMT)
committerRaymond Hettinger <python@rcn.com>2015-01-19 05:25:15 (GMT)
commited741d4ff0e79c89ba77906eb9417025c3935c71 (patch)
tree92d479b8870ba43d59cfc723c14f25a90027bc6b /Objects/setobject.c
parentbd9b200b872c2345c84af4fd98f5d0c8b674cc58 (diff)
downloadcpython-ed741d4ff0e79c89ba77906eb9417025c3935c71.zip
cpython-ed741d4ff0e79c89ba77906eb9417025c3935c71.tar.gz
cpython-ed741d4ff0e79c89ba77906eb9417025c3935c71.tar.bz2
A hybrid of and-masking and a conditional-set-to-zero produce even faster search loop.
Diffstat (limited to 'Objects/setobject.c')
-rw-r--r--Objects/setobject.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/Objects/setobject.c b/Objects/setobject.c
index f865d1c..ddf6822 100644
--- a/Objects/setobject.c
+++ b/Objects/setobject.c
@@ -671,7 +671,8 @@ set_pop(PySetObject *so)
while ((entry = &so->table[i])->key == NULL || entry->key==dummy) {
i++;
- i &= so->mask;
+ if (i > so->mask)
+ i = 0;
}
key = entry->key;
entry->key = dummy;