table of contents
rte_bitops.h(3) | DPDK | rte_bitops.h(3) |
NAME¶
rte_bitops.h
SYNOPSIS¶
#include <stdint.h>
#include <rte_debug.h>
Macros¶
#define RTE_BIT64(nr) (UINT64_C(1) << (nr))
#define RTE_BIT32(nr) (UINT32_C(1) << (nr))
#define RTE_IS_POWER_OF_2(n) ((n) && !(((n) - 1) & (n)))
Functions¶
static uint32_t rte_bit_relaxed_get32 (unsigned int nr,
volatile uint32_t *addr)
static void rte_bit_relaxed_set32 (unsigned int nr, volatile uint32_t
*addr)
static void rte_bit_relaxed_clear32 (unsigned int nr, volatile uint32_t
*addr)
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 uint64_t rte_bit_relaxed_get64 (unsigned int nr, volatile
uint64_t *addr)
static void rte_bit_relaxed_set64 (unsigned int nr, volatile uint64_t
*addr)
static void rte_bit_relaxed_clear64 (unsigned int nr, volatile uint64_t
*addr)
static uint64_t rte_bit_relaxed_test_and_set64 (unsigned int nr,
volatile uint64_t *addr)
static uint64_t rte_bit_relaxed_test_and_clear64 (unsigned int nr,
volatile uint64_t *addr)
static unsigned int rte_clz32 (uint32_t v)
static unsigned int rte_clz64 (uint64_t v)
static unsigned int rte_ctz32 (uint32_t v)
static unsigned int rte_ctz64 (uint64_t v)
static unsigned int rte_popcount32 (uint32_t v)
static unsigned int rte_popcount64 (uint64_t v)
static uint32_t rte_combine32ms1b (uint32_t x)
static uint64_t rte_combine64ms1b (uint64_t v)
static uint32_t rte_bsf32 (uint32_t v)
static int rte_bsf32_safe (uint32_t v, uint32_t *pos)
static uint32_t rte_bsf64 (uint64_t v)
static int rte_bsf64_safe (uint64_t v, uint32_t *pos)
static uint32_t rte_fls_u32 (uint32_t x)
static uint32_t rte_fls_u64 (uint64_t x)
static int rte_is_power_of_2 (uint32_t n)
static uint32_t rte_align32pow2 (uint32_t x)
static uint32_t rte_align32prevpow2 (uint32_t x)
static uint64_t rte_align64pow2 (uint64_t v)
static uint64_t rte_align64prevpow2 (uint64_t v)
static uint32_t rte_log2_u32 (uint32_t v)
static uint32_t rte_log2_u64 (uint64_t v)
Detailed Description¶
Bit Operations
This file defines a family of APIs for bit operations without enforcing memory ordering.
Definition in file rte_bitops.h.
Macro Definition Documentation¶
#define RTE_BIT64(nr) (UINT64_C(1) << (nr))¶
Get the uint64_t value for a specified bit set.
Parameters
Definition at line 32 of file rte_bitops.h.
#define RTE_BIT32(nr) (UINT32_C(1) << (nr))¶
Get the uint32_t value for a specified bit set.
Parameters
Definition at line 40 of file rte_bitops.h.
#define RTE_IS_POWER_OF_2(n) ((n) && !(((n) - 1) & (n)))¶
Macro to return 1 if n is a power of 2, 0 otherwise
Definition at line 597 of file rte_bitops.h.
Function Documentation¶
static uint32_t rte_bit_relaxed_get32 (unsigned int nr, volatile uint32_t * addr) [inline], [static]¶
Get the target bit from a 32-bit value without memory ordering.
Parameters
addr The address holding the bit.
Returns
Definition at line 55 of file rte_bitops.h.
static void rte_bit_relaxed_set32 (unsigned int nr, volatile uint32_t * addr) [inline], [static]¶
Set the target bit in a 32-bit value to 1 without memory ordering.
Parameters
addr The address holding the bit.
Definition at line 72 of file rte_bitops.h.
static void rte_bit_relaxed_clear32 (unsigned int nr, volatile uint32_t * addr) [inline], [static]¶
Clear the target bit in a 32-bit value to 0 without memory ordering.
Parameters
addr The address holding the bit.
Definition at line 89 of file rte_bitops.h.
static uint32_t rte_bit_relaxed_test_and_set32 (unsigned int nr, volatile uint32_t * addr) [inline], [static]¶
Return the original bit from a 32-bit value, then set it to 1 without memory ordering.
Parameters
addr The address holding the bit.
Returns
Definition at line 109 of file rte_bitops.h.
static uint32_t rte_bit_relaxed_test_and_clear32 (unsigned int nr, volatile uint32_t * addr) [inline], [static]¶
Return the original bit from a 32-bit value, then clear it to 0 without memory ordering.
Parameters
addr The address holding the bit.
Returns
Definition at line 131 of file rte_bitops.h.
static uint64_t rte_bit_relaxed_get64 (unsigned int nr, volatile uint64_t * addr) [inline], [static]¶
Get the target bit from a 64-bit value without memory ordering.
Parameters
addr The address holding the bit.
Returns
Definition at line 154 of file rte_bitops.h.
static void rte_bit_relaxed_set64 (unsigned int nr, volatile uint64_t * addr) [inline], [static]¶
Set the target bit in a 64-bit value to 1 without memory ordering.
Parameters
addr The address holding the bit.
Definition at line 171 of file rte_bitops.h.
static void rte_bit_relaxed_clear64 (unsigned int nr, volatile uint64_t * addr) [inline], [static]¶
Clear the target bit in a 64-bit value to 0 without memory ordering.
Parameters
addr The address holding the bit.
Definition at line 188 of file rte_bitops.h.
static uint64_t rte_bit_relaxed_test_and_set64 (unsigned int nr, volatile uint64_t * addr) [inline], [static]¶
Return the original bit from a 64-bit value, then set it to 1 without memory ordering.
Parameters
addr The address holding the bit.
Returns
Definition at line 208 of file rte_bitops.h.
static uint64_t rte_bit_relaxed_test_and_clear64 (unsigned int nr, volatile uint64_t * addr) [inline], [static]¶
Return the original bit from a 64-bit value, then clear it to 0 without memory ordering.
Parameters
addr The address holding the bit.
Returns
Definition at line 230 of file rte_bitops.h.
static unsigned int rte_clz32 (uint32_t v) [inline], [static]¶
Get the count of leading 0-bits in v.
Parameters
Returns
Definition at line 353 of file rte_bitops.h.
static unsigned int rte_clz64 (uint64_t v) [inline], [static]¶
Get the count of leading 0-bits in v.
Parameters
Returns
Definition at line 367 of file rte_bitops.h.
static unsigned int rte_ctz32 (uint32_t v) [inline], [static]¶
Get the count of trailing 0-bits in v.
Parameters
Returns
Definition at line 381 of file rte_bitops.h.
static unsigned int rte_ctz64 (uint64_t v) [inline], [static]¶
Get the count of trailing 0-bits in v.
Parameters
Returns
Definition at line 395 of file rte_bitops.h.
static unsigned int rte_popcount32 (uint32_t v) [inline], [static]¶
Get the count of 1-bits in v.
Parameters
Returns
Definition at line 409 of file rte_bitops.h.
static unsigned int rte_popcount64 (uint64_t v) [inline], [static]¶
Get the count of 1-bits in v.
Parameters
Returns
Definition at line 423 of file rte_bitops.h.
static uint32_t rte_combine32ms1b (uint32_t x) [inline], [static]¶
Combines 32b inputs most significant set bits into the least significant bits to construct a value with the same MSBs as x but all 1's under it.
Parameters
Returns
Definition at line 441 of file rte_bitops.h.
static uint64_t rte_combine64ms1b (uint64_t v) [inline], [static]¶
Combines 64b inputs most significant set bits into the least significant bits to construct a value with the same MSBs as x but all 1's under it.
Parameters
Returns
Definition at line 463 of file rte_bitops.h.
static uint32_t rte_bsf32 (uint32_t v) [inline], [static]¶
Searches the input parameter for the least significant set bit (starting from zero). If a least significant 1 bit is found, its bit index is returned. If the content of the input parameter is zero, then the content of the return value is undefined.
Parameters
Returns
Definition at line 487 of file rte_bitops.h.
static int rte_bsf32_safe (uint32_t v, uint32_t * pos) [inline], [static]¶
Searches the input parameter for the least significant set bit (starting from zero). Safe version (checks for input parameter being zero).
Warning
Parameters
pos If v was not 0, this value will contain position of least significant bit within the input parameter.
Returns
Definition at line 507 of file rte_bitops.h.
static uint32_t rte_bsf64 (uint64_t v) [inline], [static]¶
Searches the input parameter for the least significant set bit (starting from zero). If a least significant 1 bit is found, its bit index is returned. If the content of the input parameter is zero, then the content of the return value is undefined.
Parameters
Returns
Definition at line 528 of file rte_bitops.h.
static int rte_bsf64_safe (uint64_t v, uint32_t * pos) [inline], [static]¶
Searches the input parameter for the least significant set bit (starting from zero). Safe version (checks for input parameter being zero).
Warning
Parameters
pos If v was not 0, this value will contain position of least significant bit within the input parameter.
Returns
Definition at line 548 of file rte_bitops.h.
static uint32_t rte_fls_u32 (uint32_t x) [inline], [static]¶
Return the last (most-significant) bit set.
Note
rte_fls_u32(0) = 0, rte_fls_u32(1) = 1, rte_fls_u32(0x80000000) = 32
Parameters
Returns
Definition at line 569 of file rte_bitops.h.
static uint32_t rte_fls_u64 (uint64_t x) [inline], [static]¶
Return the last (most-significant) bit set.
Note
rte_fls_u64(0) = 0, rte_fls_u64(1) = 1, rte_fls_u64(0x8000000000000000) = 64
Parameters
Returns
Definition at line 587 of file rte_bitops.h.
static int rte_is_power_of_2 (uint32_t n) [inline], [static]¶
Returns true if n is a power of 2
Parameters
Returns
Definition at line 606 of file rte_bitops.h.
static uint32_t rte_align32pow2 (uint32_t x) [inline], [static]¶
Aligns input parameter to the next power of 2
Parameters
Returns
Definition at line 621 of file rte_bitops.h.
static uint32_t rte_align32prevpow2 (uint32_t x) [inline], [static]¶
Aligns input parameter to the previous power of 2
Parameters
Returns
Definition at line 639 of file rte_bitops.h.
static uint64_t rte_align64pow2 (uint64_t v) [inline], [static]¶
Aligns 64b input parameter to the next power of 2
Parameters
Returns
Definition at line 656 of file rte_bitops.h.
static uint64_t rte_align64prevpow2 (uint64_t v) [inline], [static]¶
Aligns 64b input parameter to the previous power of 2
Parameters
Returns
Definition at line 674 of file rte_bitops.h.
static uint32_t rte_log2_u32 (uint32_t v) [inline], [static]¶
Return the rounded-up log2 of a integer.
Note
Parameters
Returns
Definition at line 693 of file rte_bitops.h.
static uint32_t rte_log2_u64 (uint64_t v) [inline], [static]¶
Return the rounded-up log2 of a 64-bit integer.
Note
Parameters
Returns
Definition at line 713 of file rte_bitops.h.
Author¶
Generated automatically by Doxygen for DPDK from the source code.
Fri Dec 15 2023 | Version 23.11.0 |