Content deleted Content added
→Non-normalized loops: reverse loop |
→Converting to a normalized loop: backwards loop normalized |
||
Line 69:
Starting at 7 is not so much of a problem, as long as the increment is regular, preferably one. When multiple statements inside the loop use the index, some private temporary variables may be created to cope with the different iteration paces.
The reverse loop (Example 5) is also easy to normalize:
<source lang=c>
// Example 5 -> normalized
for ( i = 0; i < MAX; i++ )
a[MAX-i] = b[MAX-i] + 5;
</source>
Note that the access is still backwards. In this case, it makes no sense to leave it backwards (as there is no [[data dependence]]), but where dependences exist, caution must be taken to revert the access as well, as it could disrupt the order of assignments.
===Impossible conversions===
|