If you need a square root function you can use this:
Code:
int intRoot(unsigned int value)
{
unsigned int result = 0;
unsigned int multiplier;
unsigned int backup;
int loopint;
for (loopint = 7; loopint >= 0; loopint--)
{
multiplier = 1 << loopint;
backup = result;
result |= multiplier;
if (result * result > value)
result = backup;
}
if (value - result * result > abs(value - ((result + 1) * (result + 1))))
result++;
return (int)result;
}
Note: this will only work with integers and will give you (the closest) integer aproximation of the square root of a number.