* Compute the integer square root. */
| 963 | * Compute the integer square root. |
| 964 | */ |
| 965 | static u_int |
| 966 | isqrt(u_int num) |
| 967 | { |
| 968 | u_int bit, root, tmp; |
| 969 | |
| 970 | bit = num != 0 ? (1u << ((fls(num) - 1) & ~1)) : 0; |
| 971 | root = 0; |
| 972 | while (bit != 0) { |
| 973 | tmp = root + bit; |
| 974 | root >>= 1; |
| 975 | if (num >= tmp) { |
| 976 | num -= tmp; |
| 977 | root += bit; |
| 978 | } |
| 979 | bit >>= 2; |
| 980 | } |
| 981 | return (root); |
| 982 | } |
| 983 | |
| 984 | /* |
| 985 | * Perform the work of the laundry thread: periodically wake up and determine |
no test coverage detected