### example

before i present my and other approaches to RTCG, here's an example:

in graphics the `power`

function is a good candidate for RTCG
because when shading a surface `power`

is called with a different
base per pixel, but the exponent remains constant as it depends only
the the surface properties.

double power(double base, int exp) {
int t, bit = 1;
int square = base;
double result = 1.0;
while (bit <= exp) {
if (bit & exp)
result *= square;
bit = bit << 1;
square *= square;
}
return result;
}

the simplest implementation:

exponent = surface();
for (i = 0; i < bign; i++)
ans[i] = power(exponent, base[i]);

can then be replaced with:
exponent = surface();
p_e = power_gen(exponent);
for (i = 0; i < bign; i++)
ans[i] = p_e(base[i]);

where `power_gen`

is a generating extionsion---it does the RTCG.
the constant (static) computation has been factored out of the loop,
leaving only the dynamic computation. the control flow is done once,
leaving only a block of multiplications in the loop.