hongweipeng <hongweichen8...@sina.com> added the comment:
More than -2, -1 -4 -8 -16 and -32 will cause many calls to __eq__.In `set_add_entry` use ``` perturb >>= PERTURB_SHIFT; i = (i * 5 + 1 + perturb) & mask; ``` get the next index.In the example,mask is 7,perturb is -2. If i = 6, after execution, the value of i has not changed.We can do one more verification like: ``` do { perturb >>= PERTURB_SHIFT; } while (i == ((i * 5 + 1 + perturb) & mask)); i = (i * 5 + 1 + perturb) & mask; ``` Of course this requires tests. ---------- nosy: +hongweipeng _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue38105> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com