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 } 阅读全文
posted @ 2012-09-20 09:28 阿加 阅读(231) 评论(0) 推荐(0) 编辑