hi,
I have a doubt on this piece of code from the function gfInvert of the pegwit algorithm that is executed the most of the time. There are two infinite loop that call each other. Through some printf we discovered that these loops call each other eight times and then the first one return.
How can I use #pragma rules in this case?
for (;;) {
if (f[0] == 1) {
assert (f[1] != 0);
gfSmallDiv (b, f[1]);
/* destroy potentially sensitive data: */
gfClear (c); gfClear (f); gfClear (g); x = j = alpha = 0;
return 0;
}
if (f[0] < g[0]) {
goto SWAP_FG;
}
SWAP_GF:
j = f[0] - g[0];
x = logt[f[f[0]]] - logt[g[g[0]]] + TOGGLE;
alpha = expt[x >= TOGGLE ? x - TOGGLE : x];
gfAddMul (f, alpha, j, g);
gfAddMul (b, alpha, j, c);
}
/* basically same code with b,c,f,g swapped */
for (;;) {
if (g[0] == 1) {
assert (g[1] != 0);
gfSmallDiv (c, g[1]);
gfCopy (b, c);
/* destroy potentially sensitive data: */
gfClear (c); gfClear (f); gfClear (g); x = j = alpha = 0;
return 0;
}
if (g[0] < f[0]) {
goto SWAP_GF;
}
SWAP_FG:
j = g[0] - f[0];
x = logt[g[g[0]]] - logt[f[f[0]]] + TOGGLE;
alpha = expt[x >= TOGGLE ? x - TOGGLE : x];
gfAddMul (g, alpha, j, f);
gfAddMul (c, alpha, j, b);
}
} /* gfInvert
Thanks,
Nicola