On 5/20/25 18:29, Eric Blake wrote:
[?? ??????? ????????? ?????? ?? ebl...@redhat.com. ???????, ?????? ??? ?????, 
?? ?????? https://aka.ms/LearnAboutSenderIdentification ]

On Tue, May 13, 2025 at 03:32:36AM +0200, Andrey Zhadchenko wrote:
and bdrv_dirty_bitmap_reverse() helper

Is 'inverse' a better name than 'reverse'?

Yeah, it sounds much better this way!
I will re-do the patchset



Signed-off-by: Andrey Zhadchenko <andrey.zhadche...@virtuozzo.com>
---
+++ b/util/hbitmap.c
@@ -940,3 +940,18 @@ char *hbitmap_sha256(const HBitmap *bitmap, Error **errp)

      return hash;
  }
+
+void hbitmap_reverse(HBitmap *bitmap)
+{
+    int64_t pnum, pos = 0;
+    int64_t size = bitmap->orig_size;
+
+    while (pos < size) {
+        if (hbitmap_status(bitmap, pos, size - pos, &pnum)) {
+            hbitmap_reset(bitmap, pos, pnum);
+        } else {
+            hbitmap_set(bitmap, pos, pnum);
+        }

To me, reverse on 1110000 would be 0000111 (swapping the order); while
inverse would be 0001111 (swapping the bits but preserving the order).

The naming change will require respinning the series, but the concept
makes sense.
> > --
Eric Blake, Principal Software Engineer
Red Hat, Inc.
Virtualization:  qemu.org | libguestfs.org



Reply via email to