Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
pycodegen
pystencils
Commits
f1fc341a
Commit
f1fc341a
authored
Nov 20, 2019
by
Michael Kuron
Browse files
cbackend: short-cut _print_Conditional if condition is a boolean atom
parent
974febd7
Pipeline
#19921
passed with stage
in 2 minutes and 25 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
pystencils/backends/cbackend.py
View file @
f1fc341a
...
...
@@ -292,6 +292,10 @@ class CBackend:
return
""
def
_print_Conditional
(
self
,
node
):
if
type
(
node
.
condition_expr
)
is
sp
.
boolalg
.
BooleanTrue
:
return
self
.
_print_Block
(
node
.
true_block
)
elif
type
(
node
.
condition_expr
)
is
sp
.
boolalg
.
BooleanFalse
:
return
self
.
_print_Block
(
node
.
false_block
)
cond_type
=
get_type_of_expression
(
node
.
condition_expr
)
if
isinstance
(
cond_type
,
VectorType
):
raise
ValueError
(
"Problem with Conditional inside vectorized loop - use vec_any or vec_all"
)
...
...
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