qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v2 5/9] hbitmap: Add hbitmap_copy


From: Fam Zheng
Subject: Re: [Qemu-devel] [PATCH v2 5/9] hbitmap: Add hbitmap_copy
Date: Thu, 20 Mar 2014 18:47:58 +0800
User-agent: Mutt/1.5.22 (2013-10-16)

On Thu, 03/20 11:22, Paolo Bonzini wrote:
> Il 12/03/2014 07:31, Fam Zheng ha scritto:
> >+HBitmap *hbitmap_copy(const HBitmap *bitmap)
> >+{
> >+    int i;
> >+    HBitmap *hb = g_memdup(bitmap, sizeof(struct HBitmap));
> >+
> >+    for (i = HBITMAP_LEVELS; i-- > 0; ) {
> >+        hb->levels[i] = g_memdup(bitmap->levels[i],
> >+                                 bitmap->size * sizeof(unsigned long));
> >+    }
> >+
> >+    return hb;
> 
> Not quite... the bitmap->size is in bits, so you need to scale it down by
> 
>         size = MAX((size + BITS_PER_LONG - 1) >> BITS_PER_LEVEL, 1);
> 
> before each memdup.
> 

This is fixed in V3 which is posted on the list.

Thanks,
Fam



reply via email to

[Prev in Thread] Current Thread [Next in Thread]