V
V
Hello:
Consider the following recursive function:
inline u64 multiplyPower(u64 V, u8 i, u64 c)
{
if (i == 0)
return V;
else
return mul( multiplyPower(V,i-1,c) , c);
}
where mul is defined as:
inline u64 mul(u64 V, u64 c)
{
if ((V & 0x8000000000000000 ))
return (V<<1) ^ c;
else
return V<<1;
}
I would like to convert the recursive function multiplyPower() to an
iterative one. Does it look possible? Can some one please help.
Thanks!
Consider the following recursive function:
inline u64 multiplyPower(u64 V, u8 i, u64 c)
{
if (i == 0)
return V;
else
return mul( multiplyPower(V,i-1,c) , c);
}
where mul is defined as:
inline u64 mul(u64 V, u64 c)
{
if ((V & 0x8000000000000000 ))
return (V<<1) ^ c;
else
return V<<1;
}
I would like to convert the recursive function multiplyPower() to an
iterative one. Does it look possible? Can some one please help.
Thanks!