* Return the last (most-significant) bit set. * * @note The last (most significant) bit is at position 64. * @note rte_fls_u64(0) = 0, rte_fls_u64(1) = 1, * rte_fls_u64(0x8000000000000000) = 64 * * @param x * The input parameter. * @return * The last (most-significant) bit set, or 0 if the input is 0. */
| 584 | * The last (most-significant) bit set, or 0 if the input is 0. |
| 585 | */ |
| 586 | static inline uint32_t |
| 587 | rte_fls_u64(uint64_t x) |
| 588 | { |
| 589 | return (x == 0) ? 0 : 64 - rte_clz64(x); |
| 590 | } |
| 591 | |
| 592 | /*********** Macros to work with powers of 2 ********/ |
| 593 |