Subversion Repositories FlightCtrl

Rev

Rev 1328 | Rev 1490 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1328 Rev 1344
Line 100... Line 100...
100
                else root--;
100
                else root--;
101
        }
101
        }
102
        return (root >> 1);
102
        return (root >> 1);
103
}
103
}
Line 104... Line -...
104
 
-
 
105
uint16_t c_sqrt_int(uint16_t a)
104
 
106
{
-
 
107
        uint16_t rem = 0;
-
 
108
        uint16_t root = 0;
-
 
109
        uint8_t i;
-
 
110
        for(i = 0; i < 16; i++)
-
 
111
        {
-
 
112
                root <<= 1;
-
 
113
                rem = ((rem << 2) + (a >> 30));
-
 
114
                a <<= 2;
-
 
115
                root++;
-
 
116
                if(root <= rem)
-
 
117
                {
-
 
118
                        rem -= root;
-
 
119
                        root++;
-
 
120
                }
-
 
121
                else root--;
-
 
122
        }
-
 
123
        return (root >> 1);
-