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
Gwenaël Samain
cython
Commits
db144000
Commit
db144000
authored
Dec 29, 2014
by
root
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Removed reused references in tree. Tweaked style.
parent
2d146971
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
61 additions
and
47 deletions
+61
-47
Cython/Compiler/Optimize.py
Cython/Compiler/Optimize.py
+61
-47
No files found.
Cython/Compiler/Optimize.py
View file @
db144000
...
@@ -661,54 +661,8 @@ class IterationTransform(Visitor.EnvTransform):
...
@@ -661,54 +661,8 @@ class IterationTransform(Visitor.EnvTransform):
bound1
,
bound2
=
bound2
,
bound1
bound1
,
bound2
=
bound2
,
bound1
abs_step
=
abs
(
step_value
)
abs_step
=
abs
(
step_value
)
if
abs_step
!=
1
:
if
abs_step
!=
1
:
if
not
(
isinstance
(
bound1
.
constant_result
,
(
int
,
long
))
and
if
(
isinstance
(
bound1
.
constant_result
,
(
int
,
long
))
and
isinstance
(
bound2
.
constant_result
,
(
int
,
long
))):
isinstance
(
bound2
.
constant_result
,
(
int
,
long
))):
spanning_type
=
PyrexTypes
.
spanning_type
(
bound1
.
type
,
bound2
.
type
)
spanning_step_type
=
PyrexTypes
.
spanning_type
(
spanning_type
,
step
.
type
)
if
step_value
<
0
:
begin_value
=
bound2
end_value
=
bound1
final_op
=
'-'
final_node
=
ExprNodes
.
SubNode
else
:
begin_value
=
bound1
end_value
=
bound2
final_op
=
'+'
final_node
=
ExprNodes
.
AddNode
beg_sub_end
=
ExprNodes
.
SubNode
(
bound1
.
pos
,
operand1
=
begin_value
,
operator
=
'-'
,
operand2
=
end_value
,
type
=
spanning_type
)
one_node
=
ExprNodes
.
IntNode
(
bound1
.
pos
,
value
=
'1'
,
constant_result
=
1
)
beg_sub_end_sub_1
=
ExprNodes
.
SubNode
(
bound1
.
pos
,
operand1
=
beg_sub_end
,
operator
=
'-'
,
operand2
=
one_node
,
type
=
spanning_step_type
)
abs_step_node
=
ExprNodes
.
IntNode
(
bound1
.
pos
,
value
=
str
(
abs_step
),
constant_value
=
abs_step
)
div_val_node
=
ExprNodes
.
DivNode
(
bound1
.
pos
,
operand1
=
beg_sub_end_sub_1
,
operator
=
'//'
,
operand2
=
abs_step_node
,
type
=
spanning_step_type
)
delta_node
=
ExprNodes
.
MulNode
(
bound1
.
pos
,
operand1
=
abs_step_node
,
operator
=
'*'
,
operand2
=
div_val_node
,
type
=
spanning_step_type
)
beg_func_delta
=
final_node
(
bound1
.
pos
,
operand1
=
bound2
,
operator
=
final_op
,
operand2
=
delta_node
,
type
=
spanning_step_type
)
bound1
=
final_node
(
bound1
.
pos
,
operand1
=
beg_func_delta
,
operator
=
final_op
,
operand2
=
one_node
,
type
=
spanning_type
)
else
:
if
step_value
<
0
:
if
step_value
<
0
:
begin_value
=
bound2
.
constant_result
begin_value
=
bound2
.
constant_result
end_value
=
bound1
.
constant_result
end_value
=
bound1
.
constant_result
...
@@ -721,6 +675,66 @@ class IterationTransform(Visitor.EnvTransform):
...
@@ -721,6 +675,66 @@ class IterationTransform(Visitor.EnvTransform):
bound1
=
ExprNodes
.
IntNode
(
bound1
=
ExprNodes
.
IntNode
(
bound1
.
pos
,
value
=
str
(
bound1_value
),
constant_result
=
bound1_value
,
bound1
.
pos
,
value
=
str
(
bound1_value
),
constant_result
=
bound1_value
,
type
=
PyrexTypes
.
spanning_type
(
bound1
.
type
,
bound2
.
type
))
type
=
PyrexTypes
.
spanning_type
(
bound1
.
type
,
bound2
.
type
))
else
:
spanning_type
=
PyrexTypes
.
spanning_type
(
bound1
.
type
,
bound2
.
type
)
spanning_step_type
=
PyrexTypes
.
spanning_type
(
spanning_type
,
step
.
type
)
if
step_value
<
0
:
begin_value
=
copy
.
copy
(
bound2
)
end_value
=
copy
.
copy
(
bound1
)
final_op
=
'-'
final_node
=
ExprNodes
.
SubNode
else
:
begin_value
=
copy
.
copy
(
bound1
)
end_value
=
copy
.
copy
(
bound2
)
final_op
=
'+'
final_node
=
ExprNodes
.
AddNode
bound1
=
final_node
(
bound1
.
pos
,
operand1
=
final_node
(
bound1
.
pos
,
operand1
=
copy
.
copy
(
bound2
),
operator
=
final_op
,
operand2
=
ExprNodes
.
MulNode
(
bound1
.
pos
,
operand1
=
ExprNodes
.
IntNode
(
bound1
.
pos
,
value
=
str
(
abs_step
),
constant_value
=
abs_step
,
type
=
spanning_step_type
),
operator
=
'*'
,
operand2
=
ExprNodes
.
DivNode
(
bound1
.
pos
,
operand1
=
ExprNodes
.
SubNode
(
bound1
.
pos
,
operand1
=
ExprNodes
.
SubNode
(
bound1
.
pos
,
operand1
=
begin_value
,
operator
=
'-'
,
operand2
=
end_value
,
type
=
spanning_type
),
operator
=
'-'
,
operand2
=
ExprNodes
.
IntNode
(
bound1
.
pos
,
value
=
'1'
,
constant_result
=
1
),
type
=
spanning_step_type
),
operator
=
'//'
,
operand2
=
ExprNodes
.
IntNode
(
bound1
.
pos
,
value
=
str
(
abs_step
),
constant_value
=
abs_step
,
type
=
spanning_step_type
),
type
=
spanning_step_type
),
type
=
spanning_step_type
),
type
=
spanning_step_type
),
operator
=
final_op
,
operand2
=
ExprNodes
.
IntNode
(
bound1
.
pos
,
value
=
'1'
,
constant_result
=
1
),
type
=
spanning_type
)
if
step_value
<
0
:
if
step_value
<
0
:
step_value
=
-
step_value
step_value
=
-
step_value
...
...
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