Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nexedi
cython
Commits
b2658ad3
Commit
b2658ad3
authored
Feb 01, 2015
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
clean up some instances of suboffsets handling in memoryview code
parent
2799242d
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
15 deletions
+11
-15
Cython/Utility/MemoryView.pyx
Cython/Utility/MemoryView.pyx
+11
-15
No files found.
Cython/Utility/MemoryView.pyx
View file @
b2658ad3
...
...
@@ -526,7 +526,7 @@ cdef class memoryview(object):
@
cname
(
'__pyx_memoryview_get_suboffsets'
)
def
__get__
(
self
):
if
self
.
view
.
suboffsets
==
NULL
:
return
[
-
1
]
*
self
.
view
.
ndim
return
(
-
1
,)
*
self
.
view
.
ndim
return
tuple
([
suboffset
for
suboffset
in
self
.
view
.
suboffsets
[:
self
.
view
.
ndim
]])
...
...
@@ -654,9 +654,8 @@ cdef tuple _unellipsify(object index, int ndim):
return
have_slices
or
nslices
,
tuple
(
result
)
cdef
assert_direct_dimensions
(
Py_ssize_t
*
suboffsets
,
int
ndim
):
cdef
int
i
for
i
in
range
(
ndim
):
if
suboffsets
[
i
]
>=
0
:
for
suboffset
in
suboffsets
[:
ndim
]:
if
suboffset
>=
0
:
raise
ValueError
(
"Indirect dimensions not supported"
)
#
...
...
@@ -1024,10 +1023,7 @@ cdef void slice_copy(memoryview memview, {{memviewslice_name}} *dst):
for
dim
in
range
(
memview
.
view
.
ndim
):
dst
.
shape
[
dim
]
=
shape
[
dim
]
dst
.
strides
[
dim
]
=
strides
[
dim
]
if
suboffsets
==
NULL
:
dst
.
suboffsets
[
dim
]
=
-
1
else
:
dst
.
suboffsets
[
dim
]
=
suboffsets
[
dim
]
dst
.
suboffsets
[
dim
]
=
suboffsets
[
dim
]
if
suboffsets
else
-
1
@
cname
(
'__pyx_memoryview_copy_object'
)
cdef
memoryview_copy
(
memoryview
memview
):
...
...
@@ -1291,21 +1287,21 @@ cdef int memoryview_copy_contents({{memviewslice_name}} src,
return
0
@
cname
(
'__pyx_memoryview_broadcast_leading'
)
cdef
void
broadcast_leading
({{
memviewslice_name
}}
*
slice
,
cdef
void
broadcast_leading
({{
memviewslice_name
}}
*
m
slice
,
int
ndim
,
int
ndim_other
)
nogil
:
cdef
int
i
cdef
int
offset
=
ndim_other
-
ndim
for
i
in
range
(
ndim
-
1
,
-
1
,
-
1
):
slice
.
shape
[
i
+
offset
]
=
slice
.
shape
[
i
]
slice
.
strides
[
i
+
offset
]
=
slice
.
strides
[
i
]
slice
.
suboffsets
[
i
+
offset
]
=
slice
.
suboffsets
[
i
]
mslice
.
shape
[
i
+
offset
]
=
m
slice
.
shape
[
i
]
mslice
.
strides
[
i
+
offset
]
=
m
slice
.
strides
[
i
]
mslice
.
suboffsets
[
i
+
offset
]
=
m
slice
.
suboffsets
[
i
]
for
i
in
range
(
offset
):
slice
.
shape
[
i
]
=
1
slice
.
strides
[
i
]
=
slice
.
strides
[
0
]
slice
.
suboffsets
[
i
]
=
-
1
m
slice
.
shape
[
i
]
=
1
mslice
.
strides
[
i
]
=
m
slice
.
strides
[
0
]
m
slice
.
suboffsets
[
i
]
=
-
1
#
### Take care of refcounting the objects in slices. Do this seperately from any copying,
...
...
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