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
90295b45
Commit
90295b45
authored
Mar 01, 2015
by
Serhiy Storchaka
Browse files
Options
Browse Files
Download
Plain Diff
Merge heads
parents
490055a1
c2083080
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
6 deletions
+12
-6
Modules/_collectionsmodule.c
Modules/_collectionsmodule.c
+12
-6
No files found.
Modules/_collectionsmodule.c
View file @
90295b45
#include "Python.h"
#include "structmember.h"
#ifdef STDC_HEADERS
#include <stddef.h>
#else
#include <sys/types.h>
/* For size_t */
#endif
/* collections module implementation of a deque() datatype
Written and maintained by Raymond D. Hettinger <python@rcn.com>
Copyright (c) 2004-2015 Python Software Foundation.
...
...
@@ -780,15 +786,15 @@ deque_item(dequeobject *deque, Py_ssize_t i)
b
=
deque
->
rightblock
;
}
else
{
i
+=
deque
->
leftindex
;
n
=
(
Py_ssize_t
)((
unsigned
)
i
/
BLOCKLEN
);
i
=
(
Py_ssize_t
)((
unsigned
)
i
%
BLOCKLEN
);
n
=
(
Py_ssize_t
)((
size_t
)
i
/
BLOCKLEN
);
i
=
(
Py_ssize_t
)((
size_t
)
i
%
BLOCKLEN
);
if
(
index
<
(
Py_SIZE
(
deque
)
>>
1
))
{
b
=
deque
->
leftblock
;
while
(
n
--
)
b
=
b
->
rightlink
;
}
else
{
n
=
(
Py_ssize_t
)(
((
unsigned
)(
deque
->
leftindex
+
Py_SIZE
(
deque
)
-
1
))
((
size_t
)(
deque
->
leftindex
+
Py_SIZE
(
deque
)
-
1
))
/
BLOCKLEN
-
n
);
b
=
deque
->
rightblock
;
while
(
n
--
)
...
...
@@ -839,15 +845,15 @@ deque_ass_item(dequeobject *deque, Py_ssize_t i, PyObject *v)
return
deque_del_item
(
deque
,
i
);
i
+=
deque
->
leftindex
;
n
=
(
Py_ssize_t
)((
unsigned
)
i
/
BLOCKLEN
);
i
=
(
Py_ssize_t
)((
unsigned
)
i
%
BLOCKLEN
);
n
=
(
Py_ssize_t
)((
size_t
)
i
/
BLOCKLEN
);
i
=
(
Py_ssize_t
)((
size_t
)
i
%
BLOCKLEN
);
if
(
index
<=
halflen
)
{
b
=
deque
->
leftblock
;
while
(
n
--
)
b
=
b
->
rightlink
;
}
else
{
n
=
(
Py_ssize_t
)(
((
unsigned
)(
deque
->
leftindex
+
Py_SIZE
(
deque
)
-
1
))
((
size_t
)(
deque
->
leftindex
+
Py_SIZE
(
deque
)
-
1
))
/
BLOCKLEN
-
n
);
b
=
deque
->
rightblock
;
while
(
n
--
)
...
...
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