32位无符号整数平方根
1 int isqrt(unsigned x)
2 {
3 unsigned m, y, b;
4
5 m = 0x40000000;
6 y = 0;
7 while(m != 0)
8 {
9 b = y | m;
10 y = y >> 1;
11 if(x >= b)
12 {
13 x = x - b;
14 y = y | m;
15 }
16 m = m >> 2;
17 }
18 return y;
19 }