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
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
cython
Commits
e3625d6d
Commit
e3625d6d
authored
Mar 21, 2010
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
code simplification in len(char*) optimisation
parent
8f88561f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
9 deletions
+4
-9
Cython/Compiler/Optimize.py
Cython/Compiler/Optimize.py
+4
-9
No files found.
Cython/Compiler/Optimize.py
View file @
e3625d6d
...
...
@@ -1232,20 +1232,15 @@ class OptimizeBuiltinCalls(Visitor.EnvTransform):
arg
=
arg
.
arg
if
not
arg
.
type
.
is_string
:
return
node
if
not
node
.
type
.
is_numeric
:
# this optimisation only works when we already replaced
# len() by PyObject_Length() which returns a Py_ssize_t
# instead of a Python object, so we can return a plain
# size_t instead without caring about Python object
# conversion etc.
return
node
node
=
ExprNodes
.
PythonCapiCallNode
(
new_node
=
ExprNodes
.
PythonCapiCallNode
(
node
.
pos
,
"strlen"
,
self
.
Pyx_strlen_func_type
,
args
=
[
arg
],
is_temp
=
node
.
is_temp
,
utility_code
=
include_string_h_utility_code
)
return
node
if
node
.
type
not
in
(
PyrexTypes
.
c_size_t_type
,
PyrexTypes
.
c_py_ssize_t_type
):
new_node
=
new_node
.
coerce_to
(
node
.
type
,
self
.
env_stack
[
-
1
])
return
new_node
Pyx_Type_func_type
=
PyrexTypes
.
CFuncType
(
Builtin
.
type_type
,
[
...
...
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