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
c106c4ab
Commit
c106c4ab
authored
Nov 01, 2014
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use simple memcpy() instead of explicit C array copying
parent
bc3667ab
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
23 deletions
+6
-23
Cython/Compiler/ExprNodes.py
Cython/Compiler/ExprNodes.py
+6
-23
No files found.
Cython/Compiler/ExprNodes.py
View file @
c106c4ab
...
@@ -4072,30 +4072,13 @@ class SliceIndexNode(ExprNode):
...
@@ -4072,30 +4072,13 @@ class SliceIndexNode(ExprNode):
else
:
else
:
array_length
=
'%s - %s'
%
(
self
.
stop_code
(),
start_offset
)
array_length
=
'%s - %s'
%
(
self
.
stop_code
(),
start_offset
)
def
copy_carray
(
dst
,
src
,
item_type
,
start
,
count
,
depth
):
code
.
globalstate
.
use_utility_code
(
UtilityCode
.
load_cached
(
"IncludeStringH"
,
"StringTools.c"
))
var_name
=
Naming
.
quick_temp_cname
code
.
putln
(
"memcpy(&(%s[%s]), %s, sizeof(%s[0]) * (%s));"
%
(
if
depth
:
self
.
base
.
result
(),
start_offset
,
var_name
+=
str
(
depth
)
rhs
.
result
(),
dst_item
,
src_item
=
'{dst}[{i}+{start}] = {src}[{i}]'
.
format
(
self
.
base
.
result
(),
array_length
src
=
src
,
))
dst
=
dst
,
start
=
start
,
i
=
var_name
).
split
(
' = '
)
code
.
putln
(
'{'
)
code
.
putln
(
'Py_ssize_t %s;'
%
var_name
)
code
.
put
(
'for ({i}=0; {i} < {count}; {i}++) '
.
format
(
i
=
var_name
,
count
=
count
))
if
item_type
.
is_array
:
copy_carray
(
dst_item
,
src_item
,
item_type
.
base_type
,
0
,
item_type
.
size
,
depth
+
1
)
else
:
code
.
putln
(
'%s = %s;'
%
(
dst_item
,
src_item
))
code
.
putln
(
'}'
)
copy_carray
(
self
.
base
.
result
(),
rhs
.
result
(),
rhs
.
type
.
base_type
,
start_offset
,
array_length
,
0
)
self
.
generate_subexpr_disposal_code
(
code
)
self
.
generate_subexpr_disposal_code
(
code
)
self
.
free_subexpr_temps
(
code
)
self
.
free_subexpr_temps
(
code
)
rhs
.
generate_disposal_code
(
code
)
rhs
.
generate_disposal_code
(
code
)
...
...
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