Introduce some missing functions to dynamic_bitmap APIs.

Acked-by: Mark Michelson <[email protected]>
Signed-off-by: Lorenzo Bianconi <[email protected]>
---
 lib/ovn-util.h | 25 +++++++++++++++++++++++--
 1 file changed, 23 insertions(+), 2 deletions(-)

diff --git a/lib/ovn-util.h b/lib/ovn-util.h
index 347b723c0..eba25f0c9 100644
--- a/lib/ovn-util.h
+++ b/lib/ovn-util.h
@@ -502,6 +502,7 @@ void sorted_array_apply_diff(const struct sorted_array *a1,
                                                     bool add),
                              const void *arg);
 
+/* */
 struct dynamic_bitmap {
     unsigned long *map;
     size_t n_elems;
@@ -562,11 +563,23 @@ dynamic_bitmap_get_n_elems(const struct dynamic_bitmap 
*db)
     return db->n_elems;
 }
 
+static inline bool
+dynamic_bitmap_is_set(const struct dynamic_bitmap *db, size_t offset)
+{
+    return bitmap_is_set(db->map, offset);
+}
+
+static inline size_t
+dynamic_bitmap_count1(const struct dynamic_bitmap *db)
+{
+    return bitmap_count1(db->map, db->capacity);
+}
+
 static inline void
 dynamic_bitmap_set1(struct dynamic_bitmap *db, int index)
 {
     ovs_assert(index < db->capacity);
-    if (!bitmap_is_set(db->map, index)) {
+    if (!dynamic_bitmap_is_set(db, index)) {
         bitmap_set1(db->map, index);
         db->n_elems++;
     }
@@ -576,12 +589,20 @@ static inline void
 dynamic_bitmap_set0(struct dynamic_bitmap *db, int index)
 {
     ovs_assert(index < db->capacity);
-    if (bitmap_is_set(db->map, index)) {
+    if (dynamic_bitmap_is_set(db, index)) {
         bitmap_set0(db->map, index);
         db->n_elems--;
     }
 }
 
+static inline void
+dynamic_bitmap_or(struct dynamic_bitmap *db,
+                  const unsigned long *arg, size_t n)
+{
+    ovs_assert(db->capacity == n);
+    bitmap_or(db->map, arg, n);
+}
+
 static inline unsigned long *
 dynamic_bitmap_clone_map(struct dynamic_bitmap *db)
 {
-- 
2.51.1

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to