diff options
author | Damjan Marion <damarion@cisco.com> | 2022-09-08 18:59:03 +0200 |
---|---|---|
committer | Florin Coras <florin.coras@gmail.com> | 2022-09-12 20:20:42 +0000 |
commit | 51a7e44172512dab3ab70fce1426fd774a4edffe (patch) | |
tree | 62f5f0aabf808627a6d13f5c379bbe7e40adbd3a /src | |
parent | 993b6bee63d4f455db0a6021c9659aad4545acf2 (diff) |
vlib: add vlib_frame_bitmap_is_bit_set
Type: improvement
Change-Id: I2f3fab893a10b060f91b07ee17b8727d241830ea
Signed-off-by: Damjan Marion <dmarion@me.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/vlib/node_funcs.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/vlib/node_funcs.h b/src/vlib/node_funcs.h index 86722705b66..45a36fef1be 100644 --- a/src/vlib/node_funcs.h +++ b/src/vlib/node_funcs.h @@ -1443,6 +1443,14 @@ vlib_frame_bitmap_count_set_bits (uword *bmp) return count; } +static_always_inline uword +vlib_frame_bitmap_is_bit_set (uword *bmp, uword bit_index) +{ + bmp += bit_index / uword_bits; + bit_index %= uword_bits; + return (bmp[0] >> bit_index) & 1; +} + static_always_inline int vlib_frame_bitmap_find_first_set (uword *bmp) { |