vppinfra: clib_bitmap fix 44/37944/4
authorMaxime Peim <mpeim@cisco.com>
Wed, 18 Jan 2023 10:57:31 +0000 (10:57 +0000)
committerDave Barach <vpp@barachs.net>
Fri, 20 Jan 2023 16:48:21 +0000 (16:48 +0000)
commit6080ed6341d4752fc7327a145b73f6066215eaf5
tree9f3015b55e5769c56975538638c0ccae99de2997
parent8bd4db5996ba1144f659ea5341f1c2727c650bcd
vppinfra: clib_bitmap fix

In clib_bitmap_set_region and clib_bitmap_set_multiple the index of
the last bit to set was off by 1. If this index was pointing to the
last bit of the bitmap, another uword would have been allocated,
even though it was unnecessary.

Moreover, in clib_bitmap_set_region, bits in the last word were not
properly set. Indeed, the n_bits_left value is wrong since n_bits
is not decreased by the number of already set bits.

Type: fix

Signed-off-by: Maxime Peim <mpeim@cisco.com>
Change-Id: I8d7ef6f47abb9f1f64f38297da2c59509d74dd72
src/plugins/unittest/bitmap_test.c
src/vppinfra/bitmap.h