Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
073ae487
Commit
073ae487
authored
Jun 23, 2017
by
INADA Naoki
Committed by
GitHub
Jun 23, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bpo-29304: simplify lookdict_index() function. (GH-2273)
parent
279a9620
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
15 deletions
+6
-15
Objects/dictobject.c
Objects/dictobject.c
+6
-15
No files found.
Objects/dictobject.c
View file @
073ae487
...
...
@@ -631,29 +631,20 @@ PyDict_New(void)
static
Py_ssize_t
lookdict_index
(
PyDictKeysObject
*
k
,
Py_hash_t
hash
,
Py_ssize_t
index
)
{
size_t
i
;
size_t
mask
=
DK_MASK
(
k
);
Py_ssize_t
ix
;
size_t
perturb
=
(
size_t
)
hash
;
size_t
i
=
(
size_t
)
hash
&
mask
;
i
=
(
size_t
)
hash
&
mask
;
ix
=
dk_get_index
(
k
,
i
);
if
(
ix
==
index
)
{
return
i
;
}
if
(
ix
==
DKIX_EMPTY
)
{
return
DKIX_EMPTY
;
}
for
(
size_t
perturb
=
hash
;;)
{
perturb
>>=
PERTURB_SHIFT
;
i
=
mask
&
((
i
<<
2
)
+
i
+
perturb
+
1
);
ix
=
dk_get_index
(
k
,
i
);
for
(;;)
{
Py_ssize_t
ix
=
dk_get_index
(
k
,
i
);
if
(
ix
==
index
)
{
return
i
;
}
if
(
ix
==
DKIX_EMPTY
)
{
return
DKIX_EMPTY
;
}
perturb
>>=
PERTURB_SHIFT
;
i
=
mask
&
(
i
*
5
+
perturb
+
1
);
}
assert
(
0
);
/* NOT REACHED */
return
DKIX_ERROR
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment