vlib: add vlib_frame_bitmap_{set,clear}_bit_at_index
[vpp.git] / src / vlib / node_funcs.h
index a75f1f3..9e0825b 100644 (file)
@@ -1403,6 +1403,22 @@ vlib_frame_bitmap_init (uword *bmp, u32 n_first_bits_set)
     bmp++[0] = 0;
 }
 
+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)
 {