Non-linear Induction Variables
The same optimizations can be applied to induction variables that are not necessarily linear functions of the loop counter; for example, the loop
j = 1; for (i=0; i < 10; ++i) { j = j << 1; }may be converted to
for (i=0; i < 10; ++i) { j = 1 << i+1; }Read more about this topic: Induction Variable
Famous quotes containing the words induction and/or variables:
“They relieve and recommend each other, and the sanity of society is a balance of a thousand insanities. She punishes abstractionists, and will only forgive an induction which is rare and casual.”
—Ralph Waldo Emerson (18031882)
“The variables are surprisingly few.... One can whip or be whipped; one can eat excrement or quaff urine; mouth and private part can be meet in this or that commerce. After which there is the gray of morning and the sour knowledge that things have remained fairly generally the same since man first met goat and woman.”
—George Steiner (b. 1929)