diff options
author | Damjan Marion <damarion@cisco.com> | 2023-03-31 12:14:41 +0000 |
---|---|---|
committer | Neale Ranns <neale@graphiant.com> | 2023-04-02 22:13:16 +0000 |
commit | 156d452750ab37a51984938bf4a8ab0e16650d82 (patch) | |
tree | c3847cc3dbcf16efc9040bbc6b94b413f94557ae | |
parent | 2c03879ce45c6568da015c01d85300eef147ece7 (diff) |
vlib: add vlib_frame_bitmap_{set,clear}_bit_at_index
Type: improvement
Change-Id: I5703728f680f0c8431e4099b398827bd094b60df
Signed-off-by: Damjan Marion <damarion@cisco.com>
-rw-r--r-- | src/vlib/node_funcs.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/vlib/node_funcs.h b/src/vlib/node_funcs.h index a75f1f3a16a..9e0825b65cb 100644 --- a/src/vlib/node_funcs.h +++ b/src/vlib/node_funcs.h @@ -1404,6 +1404,22 @@ vlib_frame_bitmap_init (uword *bmp, u32 n_first_bits_set) } static_always_inline void +vlib_frame_bitmap_set_bit_at_index (uword *bmp, uword bit_index) +{ + bmp += bit_index / uword_bits; + bit_index %= uword_bits; + bmp[0] |= 1 << bit_index; +} + +static_always_inline void +_vlib_frame_bitmap_clear_bit_at_index (uword *bmp, uword bit_index) +{ + bmp += bit_index / uword_bits; + bit_index %= uword_bits; + bmp[0] &= ~((uword) 1 << bit_index); +} + +static_always_inline void vlib_frame_bitmap_clear (uword *bmp) { u32 n_left = VLIB_FRAME_BITMAP_N_UWORDS; |