Content deleted Content added
rearrange; reword a bit |
Augmented tags. I presume it is C. Could be Java. |
||
Line 12:
If we consider the following code sample, two optimization possibilities can be applied.
<source lang="C">
while (j < maximum - 1)
{
j = j + (4+array[k])*pi+5;
}
</
The calculation of <code>maximum - 1</code> and <code>(4+array[k])*pi+5</code> can be moved outside the loop, and precalculated, resulting in something similar to:
<source lang="C">
int maxval = maximum - 1;
int calcval = (4+array[k])*pi+5;
while (j < maxval)
{
}
</
[[Category:Compiler optimizations]]
|