32 #define RTE_BIT64(nr) (UINT64_C(1) << (nr)) 40 #define RTE_BIT32(nr) (UINT32_C(1) << (nr)) 50 #define RTE_SHIFT_VAL32(val, nr) (UINT32_C(val) << (nr)) 60 #define RTE_SHIFT_VAL64(val, nr) (UINT64_C(val) << (nr)) 71 #define RTE_GENMASK32(high, low) \ 72 (((~UINT32_C(0)) << (low)) & (~UINT32_C(0) >> (31u - (high)))) 83 #define RTE_GENMASK64(high, low) \ 84 (((~UINT64_C(0)) << (low)) & (~UINT64_C(0) >> (63u - (high)))) 94 #define RTE_FIELD_GET32(mask, reg) \ 95 ((typeof(mask))(((reg) & (mask)) >> rte_ctz32(mask))) 105 #define RTE_FIELD_GET64(mask, reg) \ 106 ((typeof(mask))(((reg) & (mask)) >> rte_ctz64(mask))) 120 static inline uint32_t
125 uint32_t mask = UINT32_C(1) << nr;
126 return (*addr) & mask;
143 *addr = (*addr) | mask;
160 *addr = (*addr) & (~mask);
174 static inline uint32_t
180 uint32_t val = *addr;
196 static inline uint32_t
202 uint32_t val = *addr;
203 *addr = val & (~mask);
219 static inline uint64_t
225 return (*addr) & mask;
242 (*addr) = (*addr) | mask;
259 *addr = (*addr) & (~mask);
273 static inline uint64_t
279 uint64_t val = *addr;
295 static inline uint64_t
301 uint64_t val = *addr;
302 *addr = val & (~mask);
306 #ifdef RTE_TOOLCHAIN_MSVC 316 static inline unsigned int 321 (void)_BitScanReverse(&rv, v);
323 return (
unsigned int)(
sizeof(v) * CHAR_BIT - 1 - rv);
334 static inline unsigned int 339 (void)_BitScanReverse64(&rv, v);
341 return (
unsigned int)(
sizeof(v) * CHAR_BIT - 1 - rv);
352 static inline unsigned int 357 (void)_BitScanForward(&rv, v);
359 return (
unsigned int)rv;
370 static inline unsigned int 375 (void)_BitScanForward64(&rv, v);
377 return (
unsigned int)rv;
388 static inline unsigned int 391 return (
unsigned int)__popcnt(v);
402 static inline unsigned int 405 return (
unsigned int)__popcnt64(v);
418 static inline unsigned int 421 return (
unsigned int)__builtin_clz(v);
432 static inline unsigned int 435 return (
unsigned int)__builtin_clzll(v);
446 static inline unsigned int 449 return (
unsigned int)__builtin_ctz(v);
460 static inline unsigned int 463 return (
unsigned int)__builtin_ctzll(v);
474 static inline unsigned int 477 return (
unsigned int)__builtin_popcount(v);
488 static inline unsigned int 491 return (
unsigned int)__builtin_popcountll(v);
506 static inline uint32_t
528 static inline uint64_t
552 static inline uint32_t
593 static inline uint32_t
634 static inline uint32_t
652 static inline uint32_t
663 #define RTE_IS_POWER_OF_2(n) ((n) && !(((n) - 1) & (n))) 674 return n && !(n & (n - 1));
686 static inline uint32_t
704 static inline uint32_t
721 static inline uint64_t
739 static inline uint64_t
758 static inline uint32_t
778 static inline uint32_t
static int rte_bsf32_safe(uint32_t v, uint32_t *pos)
static void rte_bit_relaxed_clear64(unsigned int nr, volatile uint64_t *addr)
static void rte_bit_relaxed_clear32(unsigned int nr, volatile uint32_t *addr)
static unsigned int rte_popcount32(uint32_t v)
static uint32_t rte_bit_relaxed_test_and_set32(unsigned int nr, volatile uint32_t *addr)
static uint32_t rte_bit_relaxed_test_and_clear32(unsigned int nr, volatile uint32_t *addr)
static unsigned int rte_clz32(uint32_t v)
static uint32_t rte_bsf32(uint32_t v)
static void rte_bit_relaxed_set32(unsigned int nr, volatile uint32_t *addr)
static uint32_t rte_align32prevpow2(uint32_t x)
static uint32_t rte_fls_u64(uint64_t x)
static uint32_t rte_bsf64(uint64_t v)
static uint32_t rte_align32pow2(uint32_t x)
static uint32_t rte_fls_u32(uint32_t x)
static int rte_is_power_of_2(uint32_t n)
static int rte_bsf64_safe(uint64_t v, uint32_t *pos)
static uint64_t rte_align64prevpow2(uint64_t v)
static uint32_t rte_log2_u32(uint32_t v)
static unsigned int rte_ctz64(uint64_t v)
static uint64_t rte_bit_relaxed_test_and_set64(unsigned int nr, volatile uint64_t *addr)
static unsigned int rte_ctz32(uint32_t v)
static uint64_t rte_align64pow2(uint64_t v)
static uint64_t rte_bit_relaxed_get64(unsigned int nr, volatile uint64_t *addr)
static uint64_t rte_bit_relaxed_test_and_clear64(unsigned int nr, volatile uint64_t *addr)
static uint32_t rte_combine32ms1b(uint32_t x)
static uint64_t rte_combine64ms1b(uint64_t v)
static void rte_bit_relaxed_set64(unsigned int nr, volatile uint64_t *addr)
static unsigned int rte_popcount64(uint64_t v)
static uint32_t rte_bit_relaxed_get32(unsigned int nr, volatile uint32_t *addr)
static unsigned int rte_clz64(uint64_t v)
static uint32_t rte_log2_u64(uint64_t v)