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
4e6a23c0
Commit
4e6a23c0
authored
Dec 31, 2014
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove some code duplication
parent
66b81226
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
8 deletions
+7
-8
Cython/Compiler/MemoryView.py
Cython/Compiler/MemoryView.py
+7
-8
No files found.
Cython/Compiler/MemoryView.py
View file @
4e6a23c0
...
...
@@ -290,11 +290,6 @@ class MemoryViewSliceBufferEntry(Buffer.BufferEntry):
"""
src
=
self
.
cname
def
load_slice_util
(
name
,
context_dict
):
proto
,
impl
=
TempitaUtilityCode
.
load_as_string
(
name
,
"MemoryView_C.c"
,
context
=
context_dict
)
return
impl
code
.
putln
(
"%(dst)s.data = %(src)s.data;"
%
locals
())
code
.
putln
(
"%(dst)s.memview = %(src)s.memview;"
%
locals
())
code
.
put_incref_memoryviewslice
(
dst
)
...
...
@@ -303,6 +298,7 @@ class MemoryViewSliceBufferEntry(Buffer.BufferEntry):
suboffset_dim_temp
=
[]
def
get_suboffset_dim
():
# create global temp variable at request
if
not
suboffset_dim_temp
:
suboffset_dim
=
code
.
funcstate
.
allocate_temp
(
PyrexTypes
.
c_int_type
,
manage_ref
=
False
)
code
.
putln
(
"%s = -1;"
%
suboffset_dim
)
...
...
@@ -336,9 +332,9 @@ class MemoryViewSliceBufferEntry(Buffer.BufferEntry):
# full slice (:), simply copy over the extent, stride
# and suboffset. Also update suboffset_dim if needed
d
[
'access'
]
=
access
code
.
put
(
load_slice_util
(
"SimpleSlice"
,
d
))
util_name
=
"SimpleSlice"
else
:
code
.
put
(
load_slice_util
(
"ToughSlice"
,
d
))
util_name
=
"ToughSlice"
new_ndim
+=
1
else
:
...
...
@@ -358,7 +354,10 @@ class MemoryViewSliceBufferEntry(Buffer.BufferEntry):
wraparound
=
int
(
directives
[
'wraparound'
]),
boundscheck
=
int
(
directives
[
'boundscheck'
])
)
code
.
put
(
load_slice_util
(
"SliceIndex"
,
d
))
util_name
=
"SliceIndex"
_
,
impl
=
TempitaUtilityCode
.
load_as_string
(
util_name
,
"MemoryView_C.c"
,
context
=
d
)
code
.
put
(
impl
)
if
suboffset_dim_temp
:
code
.
funcstate
.
release_temp
(
suboffset_dim_temp
[
0
])
...
...
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