bugfix: ' floating point exception' due wrongly placed code

while integrating the old 'getSqrt()' function into the 'bsqrt()'
function i misplaced some code. this lead to 'r' being 0 on the
first run. doh.
This commit is contained in:
Mathias Gumz 2010-09-21 00:04:46 +02:00
parent b530c14051
commit ae7a54a4b6

View file

@ -76,9 +76,10 @@ unsigned long bsqrt(unsigned int x) {
sqrt_table[0] = 0;
sqrt_table[1] = 1;
unsigned long r = x >> 1;
unsigned long r;
unsigned long q;
for (x = 2; x < SQRT_TABLE_ENTRIES; x++) {
r = x >> 1;
while (1) {
q = x / r;
if (q >= r) {