rte_bitset.h(3)

rte_bitset.h(3) โ€” Library Functions Manual ๐Ÿ’…โœจ

okay bestie, this is the manual page for rte_bitset.h. no cap, it's giving bitset realness. every macro, function, value, warning and line number is staying exactly where it belongs. ๐Ÿซถ

NAME ๐ŸŽ€

rte_bitset.h โ€” the header that lets you query and manipulate sets of bits kept in arrays of uint64_t-sized elements. iconic. ๐Ÿ’–

SYNOPSIS ๐Ÿฆ‹

#include <limits.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <rte_bitops.h>
#include <rte_branch_prediction.h>
#include <rte_common.h>
#include <rte_compat.h>
#include <rte_debug.h>
#include <rte_memcpy.h>

Macros ๐Ÿงฉ

#define RTE_BITSET_WORD_SIZE   (sizeof(uint64_t))
#define RTE_BITSET_WORD_BITS   (RTE_BITSET_WORD_SIZE * CHAR_BIT)
#define RTE_BITSET_NUM_WORDS(size)
#define RTE_BITSET_SIZE(size)
#define RTE_BITSET_DECLARE(name,  size)
#define RTE_BITSET_FOREACH_SET(var,  bitset,  size)
#define RTE_BITSET_FOREACH_CLEAR(var,  bitset,  size)
#define RTE_BITSET_FOREACH_SET_RANGE(var,  bitset,  size,  start_bit,  len)
#define RTE_BITSET_FOREACH_CLEAR_RANGE(var,  bitset,  size,  start_bit,  len)

Functions ๐Ÿงฉ

static __rte_experimental void rte_bitset_init (uint64_t *bitset, size_t size)
static __rte_experimental bool rte_bitset_test (const uint64_t *bitset, size_t bit_num)
static __rte_experimental void rte_bitset_set (uint64_t *bitset, size_t bit_num)
static __rte_experimental void rte_bitset_clear (uint64_t *bitset, size_t bit_num)
static __rte_experimental void rte_bitset_assign (uint64_t *bitset, size_t bit_num, bool bit_value)
static __rte_experimental void rte_bitset_flip (uint64_t *bitset, size_t bit_num)
static __rte_experimental bool rte_bitset_atomic_test (const uint64_t *bitset, size_t bit_num, int memory_order)
static __rte_experimental void rte_bitset_atomic_set (uint64_t *bitset, size_t bit_num, int memory_order)
static __rte_experimental void rte_bitset_atomic_clear (uint64_t *bitset, size_t bit_num, int memory_order)
static __rte_experimental void rte_bitset_atomic_assign (uint64_t *bitset, size_t bit_num, bool bit_value, int memory_order)
static __rte_experimental void rte_bitset_atomic_flip (uint64_t *bitset, size_t bit_num, int memory_order)
static __rte_experimental void rte_bitset_set_all (uint64_t *bitset, size_t size)
static __rte_experimental void rte_bitset_clear_all (uint64_t *bitset, size_t size)
static __rte_experimental size_t rte_bitset_count_set (const uint64_t *bitset, size_t size)
static __rte_experimental size_t rte_bitset_count_clear (const uint64_t *bitset, size_t size)
static __rte_experimental ssize_t rte_bitset_find_first_set (const uint64_t *bitset, size_t size)
static __rte_experimental ssize_t rte_bitset_find_set (const uint64_t *bitset, size_t size, size_t start_bit, size_t len)
static __rte_experimental ssize_t rte_bitset_find_set_wrap (const uint64_t *bitset, size_t size, size_t start_bit, size_t len)
static __rte_experimental ssize_t rte_bitset_find_first_clear (const uint64_t *bitset, size_t size)
static __rte_experimental ssize_t rte_bitset_find_clear (const uint64_t *bitset, size_t size, size_t start_bit, size_t len)
static __rte_experimental ssize_t rte_bitset_find_clear_wrap (const uint64_t *bitset, size_t size, size_t start_bit, size_t len)
static __rte_experimental void rte_bitset_copy (uint64_t *__rte_restrict dst_bitset, const uint64_t *__rte_restrict src_bitset, size_t size)
static __rte_experimental void rte_bitset_or (uint64_t *dst_bitset, const uint64_t *src_bitset0, const uint64_t *src_bitset1, size_t size)
static __rte_experimental void rte_bitset_and (uint64_t *dst_bitset, const uint64_t *src_bitset0, const uint64_t *src_bitset1, size_t size)
static __rte_experimental void rte_bitset_xor (uint64_t *dst_bitset, const uint64_t *src_bitset0, const uint64_t *src_bitset1, size_t size)
static __rte_experimental void rte_bitset_complement (uint64_t *dst_bitset, const uint64_t *src_bitset, size_t size)
static __rte_experimental void rte_bitset_shift_left (uint64_t *dst_bitset, const uint64_t *src_bitset, size_t size, size_t shift_bits)
static __rte_experimental void rte_bitset_shift_right (uint64_t *dst_bitset, const uint64_t *src_bitset, size_t size, size_t shift_bits)
static __rte_experimental bool rte_bitset_equal (const uint64_t *bitset_a, const uint64_t *bitset_b, size_t size)
__rte_experimental ssize_t rte_bitset_to_str (const uint64_t *bitset, size_t size, char *buf, size_t capacity)

Detailed Description ๐ŸŒˆ

RTE Bitset โ€” yes, that's the name, and it's lowkey iconic.

This file provides functions and macros for querying and manipulating sets of bits kept in arrays of uint64_t-sized elements. basically a glow-up for bit arrays. ๐Ÿ’…

The bits in a bitset are numbered from 0 to size - 1, with the lowest index being the least significant bit. so index 0 is the LSB, periodt. ๐Ÿ”ข

The bitset array must be properly aligned. don't be messy with alignment, bestie. ๐Ÿ“

For optimal performance, the size parameter, required by many of the API's functions, should be a compile-time constant. make it constant if you want that speed. โšก

For large bitsets, the rte_bitmap.h API may be more appropriate. just saying. ๐Ÿ—บ๏ธ

Warning โ€” All functions modifying a bitset may overwrite any unused bits of the last word. Such unused bits are ignored by all functions reading bits. โš ๏ธ
Definition in file rte_bitset.h.

Macro Definition Documentation ๐Ÿ“š

#define RTE_BITSET_WORD_SIZE (sizeof(uint64_t))

okay so this is the size (in bytes) of each element in the array used to represent a bitset. it's literally sizeof(uint64_t). ๐Ÿ’…

Definition at line 53 of file rte_bitset.h.

#define RTE_BITSET_WORD_BITS (RTE_BITSET_WORD_SIZE * CHAR_BIT)

the size (in bits) of each element in the array used to represent a bitset. yes bestie, it multiplies the word size by CHAR_BIT. ๐ŸŒˆ

Definition at line 59 of file rte_bitset.h.

#define RTE_BITSET_NUM_WORDS( size)

Value:

((size + RTE_BITSET_WORD_BITS - 1) / RTE_BITSET_WORD_BITS)

computes the number of words required to store size bits. math girl summer. ๐Ÿงฎโœจ

Definition at line 64 of file rte_bitset.h.

#define RTE_BITSET_SIZE( size)

Value:

((size_t)(RTE_BITSET_NUM_WORDS(size) * RTE_BITSET_WORD_SIZE))

computes the amount of memory (in bytes) required to fit a bitset holding size bits. slay. ๐Ÿ’พ

Definition at line 71 of file rte_bitset.h.

#define RTE_BITSET_DECLARE( name, size)

Value:

uint64_t name[RTE_BITSET_NUM_WORDS(size)]
Warning โ€” EXPERIMENTAL: this API may change without prior notice. ๐Ÿ˜ญ

Declare a bitset. Declare (e.g., as a struct field) or define (e.g., as a stack variable) a bitset of the specified size. it's giving "make it official". ๐Ÿ‘‘

Parameters

  • size โ€” The number of bits the bitset must be able to represent. Must be a compile-time constant.
  • name โ€” The field or variable name of the resulting definition.
Definition at line 104 of file rte_bitset.h.

#define RTE_BITSET_FOREACH_SET( var, bitset, size)

Value:

__RTE_BITSET_FOREACH(var, bitset, size, 0, size, 0)
Warning โ€” EXPERIMENTAL: this API may change without prior notice. ๐Ÿ’€

Iterate over all bits set. This macro iterates over all bits set (i.e., all ones) in the bitset, in the forward direction (i.e., starting with the least significant '1'). periodt. ๐Ÿ”ฅ

Parameters

  • var โ€” An iterator variable of type ssize_t. For each successive iteration, this variable will hold the bit index of a set bit.
  • bitset โ€” A const uint64_t * pointer to the bitset array.
  • size โ€” The size of the bitset (in bits).
Definition at line 135 of file rte_bitset.h.

#define RTE_BITSET_FOREACH_CLEAR( var, bitset, size)

Value:

__RTE_BITSET_FOREACH(var, bitset, size, 0, size, __RTE_BITSET_FIND_FLAG_FIND_CLEAR)
Warning โ€” EXPERIMENTAL: this API may change without prior notice. ๐Ÿซ 

Iterate over all bits cleared. This macro iterates over all bits cleared in the bitset, in the forward direction (i.e., starting with the lowest-indexed set bit). ngl, it's giving zero energy but make it useful. ๐Ÿ•ณ๏ธ

Parameters

  • var โ€” An iterator variable of type ssize_t. For each successive iteration, this variable will hold the bit index of a cleared bit.
  • bitset โ€” A const uint64_t * pointer to the bitset array.
  • size โ€” The size of the bitset (in bits).
Definition at line 155 of file rte_bitset.h.

#define RTE_BITSET_FOREACH_SET_RANGE( var, bitset, size, start_bit, len)

Value:

__RTE_BITSET_FOREACH(var, bitset, size, start_bit, len, 0)
Warning โ€” EXPERIMENTAL: this API may change without prior notice. โš ๏ธ

Iterate over all bits set within a range. This macro iterates over all bits set (i.e., all ones) in the specified range, in the forward direction (i.e., starting with the least significant '1'). it's a targeted slay. ๐ŸŽฏ

Parameters

  • var โ€” An iterator variable of type ssize_t. For each successive iteration, this variable will hold the bit index of a set bit.
  • bitset โ€” A const uint64_t * pointer to the bitset array.
  • size โ€” The size of the bitset (in bits).
  • start_bit โ€” The index of the first bit to check. Must be less than size.
  • len โ€” The length (in bits) of the range. start_bit + len must be less than or equal to size.
Definition at line 181 of file rte_bitset.h.

#define RTE_BITSET_FOREACH_CLEAR_RANGE( var, bitset, size, start_bit, len)

Value:

__RTE_BITSET_FOREACH(var, bitset, size, start_bit, len, __RTE_BITSET_FIND_FLAG_FIND_CLEAR)
Warning โ€” EXPERIMENTAL: this API may change without prior notice. ๐Ÿ™ˆ

Iterate over all cleared bits within a range. This macro iterates over all bits cleared (i.e., all zeroes) in the specified range, in the forward direction (i.e., starting with the least significant '0'). iconic. โœจ

Parameters

  • var โ€” An iterator variable of type ssize_t. For each successive iteration, this variable will hold the bit index of a set bit.
  • bitset โ€” A const uint64_t * pointer to the bitset array.
  • size โ€” The size of the bitset (in bits).
  • start_bit โ€” The index of the first bit to check. Must be less than size.
  • len โ€” The length (in bits) of the range. start_bit + len must be less than or equal to size.
Definition at line 207 of file rte_bitset.h.

Function Documentation ๐Ÿ› ๏ธ

__rte_experimental void rte_bitset_init (uint64_t * bitset, size_t size) โ€” [inline], [static]

Warning โ€” EXPERIMENTAL: this API may change without prior notice. ๐Ÿ’œ

Initializes a bitset. All bits are cleared. In case all words in the bitset array are already set to zero by other means (e.g., at the time of memory allocation), this function need not be called. so if it's already zeroed, you can skip it, bestie. ๐Ÿงผ

Parameters

  • bitset โ€” A pointer to the array of bitset 64-bit words.
  • size โ€” The size of the bitset (in bits).
Definition at line 236 of file rte_bitset.h.

__rte_experimental bool rte_bitset_test (const uint64_t * bitset, size_t bit_num) โ€” [inline], [static]

Warning โ€” EXPERIMENTAL: this API may change without prior notice. ๐Ÿฆ‹

Test if a bit is set. ๐Ÿ‘€

Parameters

  • bitset โ€” A pointer to the array of words making up the bitset.
  • bit_num โ€” Index of the bit to test. Index 0 is the least significant bit.

Returns Returns true if the bit is '1', and false if the bit is '0'.

Definition at line 256 of file rte_bitset.h.


๐ŸŽ€ rte_bitset_set

__rte_experimental void rte_bitset_set(uint64_t *bitset, size_t bit_num)

[inline], [static]

โš ๏ธ EXPERIMENTAL: this API may change without prior notice.

okay so this one sets a bit in the bitset ๐Ÿ’… like. just flips that lil dude to 1. slay.

Bits are numbered from 0 to (size - 1) (inclusive).

The operation is not guaranteed to be atomic. so don't come crying to me if you're out here threading, bestie ๐Ÿ˜ญ

Parameters

  • bitset โ€” A pointer to the array of words making up the bitset.
  • bit_num โ€” The index of the bit to be set.

Definition at line 284 of file rte_bitset.h.


๐Ÿฆ‹ rte_bitset_clear

__rte_experimental void rte_bitset_clear(uint64_t *bitset, size_t bit_num)

[inline], [static]

โš ๏ธ EXPERIMENTAL: this API may change without prior notice.

Clears a bit in the bitset โ€” bye bye 1, hello 0 ๐Ÿซถ

Bits are numbered 0 to (size - 1) (inclusive).

The operation is not guaranteed to be atomic. fr fr, no cap.

Parameters

  • bitset โ€” A pointer to the array of words making up the bitset.
  • bit_num โ€” The index of the bit to be cleared.

Definition at line 312 of file rte_bitset.h.


๐ŸŒธ rte_bitset_assign

__rte_experimental void rte_bitset_assign(uint64_t *bitset, size_t bit_num, bool bit_value)

[inline], [static]

โš ๏ธ EXPERIMENTAL: this API may change without prior notice.

The choose-your-own-adventure one โœจ you pass in a value and it either sets or clears the bit for you. main character energy, honestly.

Bits are numbered 0 to (size - 1) (inclusive).

The operation is not guaranteed to be atomic.

Parameters

  • bitset โ€” A pointer to the array of words making up the bitset.
  • bit_num โ€” The index of the bit to be set or cleared.
  • bit_value โ€” Control if the bit should be set or cleared.

Definition at line 342 of file rte_bitset.h.


๐Ÿ’… rte_bitset_flip

__rte_experimental void rte_bitset_flip(uint64_t *bitset, size_t bit_num)

[inline], [static]

โš ๏ธ EXPERIMENTAL: this API may change without prior notice.

Flips that bit's whole vibe ๐Ÿ”ฅ 1 becomes 0, 0 becomes 1. it's giving glow-up.

Bits are numbered 0 to (size - 1) (inclusive).

The operation is not guaranteed to be atomic.

Parameters

  • bitset โ€” A pointer to the array of words making up the bitset.
  • bit_num โ€” The index of the bit to be flipped.

Definition at line 371 of file rte_bitset.h.


โญ rte_bitset_atomic_test

__rte_experimental bool rte_bitset_atomic_test(const uint64_t *bitset, size_t bit_num, int memory_order)

[inline], [static]

โš ๏ธ EXPERIMENTAL: this API may change without prior notice.

Question: is this bit set? ASK ATOMICALLY โœจ Tests whether a bit in a bitset is set, using the memory ordering you asked for.

Parameters

  • bitset โ€” A pointer to the array of words making up the bitset.
  • bit_num โ€” Index of the bit to test. Index 0 is the least significant bit.
  • memory_order โ€” The memory order to use.

Returns

Returns true if the bit is '1', and false if the bit is '0'. simple as that, bestie ๐Ÿ’–

Definition at line 402 of file rte_bitset.h.


๐Ÿ”ฅ rte_bitset_atomic_set

__rte_experimental void rte_bitset_atomic_set(uint64_t *bitset, size_t bit_num, int memory_order)

[inline], [static]

โš ๏ธ EXPERIMENTAL: this API may change without prior notice.

Sets a bit in a bitset as an atomic operation, with the specified memory ordering. no race conditions in this house ๐Ÿšซ๐Ÿƒ

rte_bitset_atomic_set() is multi-thread safe, provided all threads acting in parallel on the same bitset does so through rte_bitset_atomic_*() functions.

iykyk: the second you mix atomic and non-atomic calls on the same bitset from different threads, all bets are off ๐Ÿ™ˆ

Bits are numbered from 0 to (size - 1) (inclusive).

Parameters

  • bitset โ€” A pointer to the array of words making up the bitset.
  • bit_num โ€” The index of the bit to be set.
  • memory_order โ€” The memory order to use.

Definition at line 438 of file rte_bitset.h.


๐Ÿงš rte_bitset_atomic_clear

__rte_experimental void rte_bitset_atomic_clear(uint64_t *bitset, size_t bit_num, int memory_order)

[inline], [static]

โš ๏ธ EXPERIMENTAL: this API may change without prior notice.

Clears a bit in a bitset as an atomic operation, with the specified memory ordering. bye bestie, bit cleared, no drama.

rte_bitset_atomic_clear() is multi-thread safe, provided all threads acting in parallel on the same bitset does so through rte_bitset_atomic_*() functions.

Bits are numbered from 0 to (size - 1) (inclusive).

Parameters

  • bitset โ€” A pointer to the array of words making up the bitset.
  • bit_num โ€” The index of the bit to be cleared.
  • memory_order โ€” The memory order to use.

Definition at line 474 of file rte_bitset.h.


๐Ÿ’œ rte_bitset_atomic_assign

__rte_experimental void rte_bitset_atomic_assign(uint64_t *bitset, size_t bit_num, bool bit_value, int memory_order)

[inline], [static]

โš ๏ธ EXPERIMENTAL: this API may change without prior notice.

Assigns a value to a bit in a bitset as an atomic operation, with the specified memory ordering. set or clear, atomically, your call ๐Ÿ’…

rte_bitset_atomic_assign() is multi-thread safe, provided all threads acting in parallel on the same bitset does so through rte_bitset_atomic_*() functions.

Bits are numbered from 0 to (size - 1) (inclusive).

Parameters

  • bitset โ€” A pointer to the array of words making up the bitset.
  • bit_num โ€” The index of the bit to be set or cleared.
  • bit_value โ€” Control if the bit should be set or cleared.
  • memory_order โ€” The memory order to use.

Definition at line 512 of file rte_bitset.h.


๐ŸŽ€ rte_bitset_atomic_flip

__rte_experimental void rte_bitset_atomic_flip(uint64_t *bitset, size_t bit_num, int memory_order)

[inline], [static]

โš ๏ธ EXPERIMENTAL: this API may change without prior notice.

Flips a bit in a bitset as an atomic operation, with the specified memory ordering. the glow-up but make it thread-safe โœจ

rte_bitset_atomic_flip() is multi-thread safe, provided all threads acting in parallel on the same bitset does so through rte_bitset_atomic_*() functions.

Bits are numbered from 0 to (size - 1) (inclusive).

Parameters

  • bitset โ€” A pointer to the array of words making up the bitset.
  • bit_num โ€” The index of the bit to be flipped.
  • memory_order โ€” The memory order to use.

Definition at line 549 of file rte_bitset.h.


๐ŸŒˆ rte_bitset_set_all

__rte_experimental void rte_bitset_set_all(uint64_t *bitset, size_t size)

[inline], [static]

โš ๏ธ EXPERIMENTAL: this API may change without prior notice.

Sets ALL the bits ๐Ÿ‘‘ every single one. we love a maximalist moment.

Parameters

  • bitset โ€” A pointer to the array of words making up the bitset.
  • size โ€” The size of the bitset (in bits).

Definition at line 574 of file rte_bitset.h.


๐Ÿซถ rte_bitset_clear_all

__rte_experimental void rte_bitset_clear_all(uint64_t *bitset, size_t size)

[inline], [static]

โš ๏ธ EXPERIMENTAL: this API may change without prior notice.

Clears ALL the bits. a fresh start, a clean slate, a reset era for the girlies ๐Ÿ˜Œ

Parameters

  • bitset โ€” A pointer to the array of words making up the bitset.
  • size โ€” The size of the bitset (in bits).

Definition at line 592 of file rte_bitset.h.


๐Ÿ“ rte_bitset_count_set

__rte_experimental size_t rte_bitset_count_set(const uint64_t *bitset, size_t size)

[inline], [static]

โš ๏ธ EXPERIMENTAL: this API may change without prior notice.

Counts all set bits โ€” also known as the weight, in case you wanna sound fancy at the function ๐Ÿ’…

Parameters

  • bitset โ€” A pointer to the array of words making up the bitset.
  • size โ€” The size of the bitset (in bits).

Returns

Returns the number of '1' bits in the bitset.

Definition at line 618 of file rte_bitset.h.


๐Ÿงš rte_bitset_count_clear

__rte_experimental size_t rte_bitset_count_clear(const uint64_t *bitset, size_t size)

[inline], [static]

โš ๏ธ EXPERIMENTAL: this API may change without prior notice.

Counts all the little cleared bits ๐Ÿซง the zeroes deserve representation too.

Parameters

  • bitset โ€” A pointer to the array of words making up the bitset.
  • size โ€” The size of the bitset (in bits).

Returns

Returns the number of '0' bits in the bitset.

Definition at line 650 of file rte_bitset.h.


โญ rte_bitset_find_first_set

__rte_experimental ssize_t rte_bitset_find_first_set(const uint64_t *bitset, size_t size)

[inline], [static]

โš ๏ธ EXPERIMENTAL: this API may change without prior notice.

Scans the bitset in the forward direction (i.e., starting at the least significant bit), and returns the index of the first '1'. it's a scavenger hunt and the prize is a set bit ๐Ÿ”

Parameters

  • bitset โ€” A pointer to the array of words making up the bitset.
  • size โ€” The size of the bitset (in bits).

Returns

Returns the index of the least significant '1', or -1 if all bits are '0'.

Definition at line 767 of file rte_bitset.h.


๐Ÿ’œ rte_bitset_find_set

__rte_experimental ssize_t rte_bitset_find_set(const uint64_t *bitset, size_t size, size_t start_bit, size_t len)

[inline], [static]

โš ๏ธ EXPERIMENTAL: this API may change without prior notice.

Scans the bitset in the forward direction (i.e., starting at the least significant bit), starting at an offset start_bit into the bitset, and returns the index of the first '1' encountered. you get to pick where the search starts, iconic behaviour honestly.

Parameters

  • bitset โ€” A pointer to the array of words making up the bitset.
  • size โ€” The size of the bitset (in bits).
  • start_bit โ€” The index of the first bit to check. Must be less than size.
  • len โ€” The number of bits to scan. start_bit + len must be less than or equal to size.

Returns

Returns the index of the least significant '1', or -1 if all bits are '0'.

Definition at line 803 of file rte_bitset.h.


๐ŸŒธ rte_bitset_find_set_wrap

__rte_experimental ssize_t rte_bitset_find_set_wrap(const uint64_t *bitset, size_t size, size_t start_bit, size_t len)

[inline], [static]

โš ๏ธ EXPERIMENTAL: this API may change without prior notice.

Scans the bitset in the forward direction (i.e., starting at the least significant bit), starting at an offset start_bit into the bitset. If no '1' is encountered before the end of the bitset, the search will continue at index 0. yes bestie, it loops around โ€” the bitset version of "and we're back" ๐Ÿ”

Parameters

  • bitset โ€” A pointer to the array of words making up the bitset.
  • size โ€” The size of the bitset (in bits).
  • start_bit โ€” The index of the first bit to check. Must be less than size.
  • len โ€” The number of bits to scan. start_bit + len must be less than or equal to size.

Returns

Returns the index of the least significant '1', or -1 if all bits are '0'.

Definition at line 842 of file rte_bitset.h.


๐Ÿฆ‹ rte_bitset_find_first_clear

__rte_experimental ssize_t rte_bitset_find_first_clear(const uint64_t *bitset, size_t size)

[inline], [static]

โš ๏ธ EXPERIMENTAL: this API may change without prior notice.

Scans the bitset in the forward direction (i.e., starting at the least significant bit), and returns the index of the first '0'. hunting for the empty seat in the row ๐ŸŽŸ๏ธ

Parameters

  • bitset โ€” A pointer to the array of words making up the bitset.
  • size โ€” The size of the bitset (in bits).

Returns

Returns the index of the least significant '0', or -1 if all bits are '1'.

Definition at line 874 of file rte_bitset.h.

rte_bitset_find_clear

__rte_experimental ssize_t rte_bitset_find_clear(const uint64_t *bitset,
    size_t size, size_t start_bit, size_t len) [inline],  [static]
โš ๏ธ EXPERIMENTAL: this API may change without prior notice. bestie it literally says it right there, so don't @ me when it shifts.

okay so this one hunts down the first cleared bit at an offset ๐Ÿ’…

It scans the bitset going forward (that means starting at the least significant bit, keep up ๐Ÿซถ), beginning at an offset of start_bit into the bitset, and it hands you back the index of the first '0' it bumps into.

Parameters

  • bitset โ€” a pointer to the array of words that make up the bitset ๐Ÿ’–
  • size โ€” the size of the bitset, in bits
  • start_bit โ€” the index of the first bit to check. Got to be less than size.
  • len โ€” how many bits to scan. start_bit + len has to be less than or equal to size.

Returns

Returns the index of the least significant '0', or -1 if every single bit is '1'.

Definition at line 910 of file rte_bitset.h.


rte_bitset_find_clear_wrap

__rte_experimental ssize_t rte_bitset_find_clear_wrap(const uint64_t *bitset,
    size_t size, size_t start_bit, size_t len) [inline],  [static]
โš ๏ธ EXPERIMENTAL: this API may change without prior notice.

Find first cleared bit at offset, with wrap-around. she does laps around the whole thing, iconique ๐ŸŒ€

Same forward-direction scan (again: that's starting at the least significant bit ๐ŸŒธ), starting at an offset of start_bit into the bitset. But here's the plot twist: if no '0' shows up before the end of the bitset, the search continues at index 0. queen of second chances honestly ๐Ÿ‘‘

Parameters

  • bitset โ€” a pointer to the array of words making up the bitset
  • size โ€” the size of the bitset, in bits
  • start_bit โ€” the index of the first bit to check. Must be less than size.
  • len โ€” the number of bits to scan. start_bit + len must be less than or equal to size.

Returns

Returns the index of the least significant '0', or -1 if all bits are '1'.

Definition at line 949 of file rte_bitset.h.


rte_bitset_copy

__rte_experimental void rte_bitset_copy(uint64_t *__rte_restrict dst_bitset,
    const uint64_t *__rte_restrict src_bitset, size_t size) [inline],  [static]
โš ๏ธ EXPERIMENTAL: this API may change without prior notice.

Copy bitset. the humble clipboard of the bitset world ๐ŸŽ€

It copies the bits of src_bitset over to dst_bitset. simple. clean. slay.

The bitsets may not overlap and must be of equal size. not a suggestion bestie, that's a hard boundary ๐Ÿ’€

Parameters

  • dst_bitset โ€” a pointer to the array of words making up the bitset ๐Ÿซถ
  • src_bitset โ€” a pointer to the array of words making up the bitset ๐Ÿซถ
  • size โ€” the size of the bitsets, in bits

Definition at line 982 of file rte_bitset.h.


rte_bitset_or

__rte_experimental void rte_bitset_or(uint64_t *dst_bitset,
    const uint64_t *src_bitset0, const uint64_t *src_bitset1, size_t size) [inline],  [static]
โš ๏ธ EXPERIMENTAL: this API may change without prior notice.

Bitwise or two bitsets. two girls, one OR, both iconic โœจ

It performs a bitwise OR on every bit in the two equal-size bitsets src_bitset0 and src_bitset1, then stashes the results in dst_bitset. no cap.

Parameters

  • dst_bitset โ€” a pointer to the destination bitset
  • src_bitset0 โ€” a pointer to the first source bitset
  • src_bitset1 โ€” a pointer to the second source bitset
  • size โ€” the size of the bitsets, in bits

Definition at line 1009 of file rte_bitset.h.


rte_bitset_and

__rte_experimental void rte_bitset_and(uint64_t *dst_bitset,
    const uint64_t *src_bitset0, const uint64_t *src_bitset1, size_t size) [inline],  [static]
โš ๏ธ EXPERIMENTAL: this API may change without prior notice.

Bitwise and two bitsets. the "both of us or nothing" energy ๐Ÿ”ฅ

It performs a bitwise AND on every bit in the two equal-size bitsets src_bitset0 and src_bitset1, and stores the result in dst_bitset.

Parameters

  • dst_bitset โ€” a pointer to the destination bitset
  • src_bitset0 โ€” a pointer to the first source bitset
  • src_bitset1 โ€” a pointer to the second source bitset
  • size โ€” the size of the bitsets, in bits

Definition at line 1039 of file rte_bitset.h.


rte_bitset_xor

__rte_experimental void rte_bitset_xor(uint64_t *dst_bitset,
    const uint64_t *src_bitset0, const uint64_t *src_bitset1, size_t size) [inline],  [static]
โš ๏ธ EXPERIMENTAL: this API may change without prior notice.

Bitwise xor two bitsets. the chaotic one, we love her for it ๐Ÿ’…

It performs a bitwise XOR on every bit in the two equal-size bitsets src_bitset0 and src_bitset1, and stores the result in dst_bitset.

Parameters

  • dst_bitset โ€” a pointer to the destination bitset
  • src_bitset0 โ€” a pointer to the first source bitset
  • src_bitset1 โ€” a pointer to the second source bitset
  • size โ€” the size of the bitsets, in bits

Definition at line 1069 of file rte_bitset.h.


rte_bitset_complement

__rte_experimental void rte_bitset_complement(uint64_t *dst_bitset,
    const uint64_t *src_bitset, size_t size) [inline],  [static]
โš ๏ธ EXPERIMENTAL: this API may change without prior notice.

Compute the bitwise complement of a bitset. the glow-up function fr fr ๐Ÿฆ‹

It flips every single bit in src_bitset and stores the result in dst_bitset. total reinvention.

Parameters

  • dst_bitset โ€” a pointer to the destination bitset
  • src_bitset โ€” a pointer to the source bitset
  • size โ€” the size of the bitsets, in bits

Definition at line 1096 of file rte_bitset.h.


rte_bitset_shift_left

__rte_experimental void rte_bitset_shift_left(uint64_t *dst_bitset,
    const uint64_t *src_bitset, size_t size, size_t shift_bits) [inline],  [static]
โš ๏ธ EXPERIMENTAL: this API may change without prior notice.

Shift bitset left. moving on up ๐Ÿ’–

It performs a logical shift left of (multiply) src_bitset, and stores the result in dst_bitset. yes bestie, multiply, that's the vibe they wrote and I'm keeping it ๐Ÿ’ฏ

Parameters

  • dst_bitset โ€” a pointer to the destination bitset
  • src_bitset โ€” a pointer to the source bitset
  • size โ€” the size of the bitsets, in bits
  • shift_bits โ€” the number of bits to shift the bitset

Definition at line 1124 of file rte_bitset.h.


rte_bitset_shift_right

__rte_experimental void rte_bitset_shift_right(uint64_t *dst_bitset,
    const uint64_t *src_bitset, size_t size, size_t shift_bits) [inline],  [static]
โš ๏ธ EXPERIMENTAL: this API may change without prior notice.

Shift bitset right. and this one's giving divide energy ๐ŸŒธ

It performs a logical shift right of (divide) src_bitset, and stores the result in dst_bitset.

Parameters

  • dst_bitset โ€” a pointer to the destination bitset
  • src_bitset โ€” a pointer to the source bitset
  • size โ€” the size of the bitsets, in bits
  • shift_bits โ€” the number of bits to shift the bitset

Definition at line 1169 of file rte_bitset.h.


rte_bitset_equal

__rte_experimental bool rte_bitset_equal(const uint64_t *bitset_a,
    const uint64_t *bitset_b, size_t size) [inline],  [static]
โš ๏ธ EXPERIMENTAL: this API may change without prior notice.

Compare two bitsets. twin check ๐Ÿ‘ฏโ€โ™€๏ธ

It compares two bitsets for equality. that's it, that's the whole thing.

Parameters

  • bitset_a โ€” a pointer to the destination bitset
  • bitset_b โ€” a pointer to the source bitset
  • size โ€” the size of the bitsets, in bits

Definition at line 1222 of file rte_bitset.h.


rte_bitset_to_str

__rte_experimental ssize_t rte_bitset_to_str(const uint64_t *bitset,
    size_t size, char *buf, size_t capacity)
โš ๏ธ EXPERIMENTAL: this API may change without prior notice.

Converts a bitset to a string. main character gets a makeover ๐Ÿ’…โœจ

This function prints a string representation of the bitstring into the buffer you supply.

Each bit shows up as either '0' or '1' in the output, and the first (left-most) character in the output is the most significant bit. The resulting string is NUL terminated. ๐ŸŽ€

Parameters

  • bitset โ€” a pointer to the array of bitset 64-bit words
  • size โ€” the number of bits the bitset represent
  • buf โ€” a buffer to hold the output
  • capacity โ€” the size of the buffer. Must be size + 1 or larger.

Returns

Returns the number of bytes written (that's size + 1), or -EINVAL in case the buffer capacity was too small. ๐Ÿ’€

Definition at line 1258 of file rte_bitset.h.


๐Ÿ‘‘ AUTHOR ๐Ÿ‘‘

Generated automatically by Doxygen for DPDK from the source code. she wrote herself, honestly? self-authored queen behavior ๐Ÿ’…


okay that's the whole page bestie, we ate ๐Ÿ“โœจ and for the cute little footer tea: this is DPDK Version 25.11.3, manual page rte_bitset.h(3) โ€” that's the source and version, iykyk. go forth and bitset responsibly, mwah ๐Ÿ’–๐ŸŽ€๐Ÿฆ‹

๐Ÿ“ฆ where this page comes from