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
8958817f
Commit
8958817f
authored
Jul 23, 2008
by
Robert Bradshaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Optimize bool by starting as bint rather than object.
parent
4896ddf8
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
19 deletions
+10
-19
Cython/Compiler/ExprNodes.py
Cython/Compiler/ExprNodes.py
+10
-19
No files found.
Cython/Compiler/ExprNodes.py
View file @
8958817f
...
...
@@ -588,25 +588,6 @@ class NoneNode(PyConstNode):
def
compile_time_value
(
self
,
denv
):
return
None
class
BoolNode
(
PyConstNode
):
# The constant value True or False
def
compile_time_value
(
self
,
denv
):
return
self
.
value
def
calculate_result_code
(
self
):
if
self
.
value
:
return
"Py_True"
else
:
return
"Py_False"
def
coerce_to
(
self
,
dst_type
,
env
):
value
=
self
.
value
if
dst_type
.
is_numeric
:
return
IntNode
(
self
.
pos
,
value
=
int
(
self
.
value
)).
coerce_to
(
dst_type
,
env
)
else
:
return
PyConstNode
.
coerce_to
(
self
,
dst_type
,
env
)
class
EllipsisNode
(
PyConstNode
):
# '...' in a subscript list.
...
...
@@ -639,6 +620,16 @@ class ConstNode(AtomicExprNode):
pass
class
BoolNode
(
ConstNode
):
type
=
PyrexTypes
.
c_bint_type
# The constant value True or False
def
compile_time_value
(
self
,
denv
):
return
self
.
value
def
calculate_result_code
(
self
):
return
int
(
self
.
value
)
class
NullNode
(
ConstNode
):
type
=
PyrexTypes
.
c_null_ptr_type
value
=
"NULL"
...
...
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