* Return zero based sequential number of the highest set bit the * number. If the number is 0, then the function returns -1. */
| 81 | * number. If the number is 0, then the function returns -1. |
| 82 | */ |
| 83 | static __inline int |
| 84 | findHighestSetBit(size_t a) |
| 85 | { |
| 86 | int n = (sizeof(size_t) * 8 - 1); |
| 87 | size_t s = (size_t)1 << n; |
| 88 | |
| 89 | for (; (s != 0) && !(s & a); s >>= 1) { |
| 90 | n--; |
| 91 | } |
| 92 | |
| 93 | return (s == 0) ? -1 : n; |
| 94 | } |
| 95 | |
| 96 | static __inline size_t |
| 97 | roundDownPow2(size_t a) |
no outgoing calls
no test coverage detected