Home
Random
Nearby
Log in
Settings
Donate Now
If Wikipedia is useful to you, please give today.
About Wikipedia
Disclaimers
Search
Loop-invariant code motion: Difference between revisions
Article
Talk
Language
Watch
View history
Edit
Browse history interactively
← Previous edit
Next edit →
Content deleted
Content added
Visual
Wikitext
Revision as of 10:06, 29 June 2018
edit
188.202.108.194
(
talk
)
→
Example
← Previous edit
Revision as of 19:37, 27 April 2019
edit
undo
Gnasher729
(
talk
|
contribs
)
30
edits
Optimization is incorrect when n <= 0
Next edit →
Line 13:
</source>
The
Assuming n > 0, the
calculation <code>x = y + z</code> and <code>x * x</code> can be moved outside the loop since within they are [[loop-invariant code]], so the optimized code will be something like this:
<source lang="C">