On Fri, Dec 23, 2016 at 05:28:59PM +0300, Vladimir Sementsov-Ogievskiy wrote: > Add this function only for HBitmap's with greanularity = 0. > > Signed-off-by: Vladimir Sementsov-Ogievskiy <vsement...@virtuozzo.com> > Reviewed-by: Pavel Butsykin <pbutsy...@virtuozzo.com> > --- > include/qemu/hbitmap.h | 2 ++ > util/hbitmap.c | 9 +++++++++ > 2 files changed, 11 insertions(+) > > diff --git a/include/qemu/hbitmap.h b/include/qemu/hbitmap.h > index 2873a46..1967e13 100644 > --- a/include/qemu/hbitmap.h > +++ b/include/qemu/hbitmap.h > @@ -314,4 +314,6 @@ static inline size_t hbitmap_iter_next_word(HBitmapIter > *hbi, unsigned long *p_c > } > > > +uint64_t hbitmap_count_between(HBitmap *hb, uint64_t start, uint64_t end);
Missing doc comments. > + > #endif > diff --git a/util/hbitmap.c b/util/hbitmap.c > index 48d8b2d..d06bfa3 100644 > --- a/util/hbitmap.c > +++ b/util/hbitmap.c > @@ -232,6 +232,15 @@ static uint64_t hb_count_between(HBitmap *hb, uint64_t > start, uint64_t last) > return count; > } > > +/* hbitmap_count_between() is only for HBitmap's with granularity = 0 */ > +uint64_t hbitmap_count_between(HBitmap *hb, uint64_t start, uint64_t end) > +{ > + assert(hb->granularity == 0); > + assert(start < end); > + > + return hb_count_between(hb, start, end - 1); > +} Please rename hb_count_between() and make it externally visible instead of adding a similarly-named wrapper.
signature.asc
Description: PGP signature