File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -631,29 +631,20 @@ PyDict_New(void)
631631static Py_ssize_t
632632lookdict_index (PyDictKeysObject * k , Py_hash_t hash , Py_ssize_t index )
633633{
634- size_t i ;
635634 size_t mask = DK_MASK (k );
636- Py_ssize_t ix ;
635+ size_t perturb = (size_t )hash ;
636+ size_t i = (size_t )hash & mask ;
637637
638- i = (size_t )hash & mask ;
639- ix = dk_get_index (k , i );
640- if (ix == index ) {
641- return i ;
642- }
643- if (ix == DKIX_EMPTY ) {
644- return DKIX_EMPTY ;
645- }
646-
647- for (size_t perturb = hash ;;) {
648- perturb >>= PERTURB_SHIFT ;
649- i = mask & ((i << 2 ) + i + perturb + 1 );
650- ix = dk_get_index (k , i );
638+ for (;;) {
639+ Py_ssize_t ix = dk_get_index (k , i );
651640 if (ix == index ) {
652641 return i ;
653642 }
654643 if (ix == DKIX_EMPTY ) {
655644 return DKIX_EMPTY ;
656645 }
646+ perturb >>= PERTURB_SHIFT ;
647+ i = mask & (i * 5 + perturb + 1 );
657648 }
658649 assert (0 ); /* NOT REACHED */
659650 return DKIX_ERROR ;
You can’t perform that action at this time.
0 commit comments