* Find highest one bit set. * Returns bit number + 1 of highest bit that is set, otherwise returns 0. * The __builtin_clzll() function is supported by both GCC and Clang. */
| 701 | * The __builtin_clzll() function is supported by both GCC and Clang. |
| 702 | */ |
| 703 | int |
| 704 | highbit64(uint64_t i) |
| 705 | { |
| 706 | if (i == 0) |
| 707 | return (0); |
| 708 | |
| 709 | return (NBBY * sizeof (uint64_t) - __builtin_clzll(i)); |
| 710 | } |
| 711 | |
| 712 | /* |
| 713 | * Find lowest one bit set. |
no outgoing calls
no test coverage detected