KerbalController
KerbalController copied to clipboard
pow is 'expensive'
Suggestion to use custom function:
int myPow2(int n) // returns 2^n, calculated in integer math
{
int result = 1;
if (n = 0) return result;
else if ( n < 0) return -1;
else if (n > 30) return -1; //overflow
else
{
for (int i = 0; i < n; i++) result = result *2;
return result;
}
}