Re: [Qemu-devel] [PATCH v2 35/45] add hierarchical bitmap data type and test cases

2012-10-24 Thread Kevin Wolf
Am 26.09.2012 17:56, schrieb Paolo Bonzini: HBitmaps provides an array of bits. The bits are stored as usual in an array of unsigned longs, but HBitmap is also optimized to provide fast iteration over set bits; going from one bit to the next is O(logB n) worst case, with B = sizeof(long) *

Re: [Qemu-devel] [PATCH v2 35/45] add hierarchical bitmap data type and test cases

2012-10-24 Thread Paolo Bonzini
Il 24/10/2012 16:41, Kevin Wolf ha scritto: +struct HBitmapIter { +const HBitmap *hb; + +/* Copied from hb for access in the inline functions (hb is opaque). */ +int granularity; + +/* Entry offset into the last-level array of longs. */ +size_t pos; Other places,

Re: [Qemu-devel] [PATCH v2 35/45] add hierarchical bitmap data type and test cases

2012-09-27 Thread Paolo Bonzini
Il 27/09/2012 04:53, Eric Blake ha scritto: +++ b/hbitmap.c @@ -0,0 +1,400 @@ +/* + * Hierarchical Bitmap Data Type + * + * Copyright Red Hat, Inc., 2012 vs. +++ b/tests/test-hbitmap.c @@ -0,0 +1,408 @@ +/* + * Hierarchical bitmap unit-tests. + * + * Copyright (C) 2012

[Qemu-devel] [PATCH v2 35/45] add hierarchical bitmap data type and test cases

2012-09-26 Thread Paolo Bonzini
HBitmaps provides an array of bits. The bits are stored as usual in an array of unsigned longs, but HBitmap is also optimized to provide fast iteration over set bits; going from one bit to the next is O(logB n) worst case, with B = sizeof(long) * CHAR_BIT: the result is low enough that the number

Re: [Qemu-devel] [PATCH v2 35/45] add hierarchical bitmap data type and test cases

2012-09-26 Thread Eric Blake
On 09/26/2012 09:56 AM, Paolo Bonzini wrote: HBitmaps provides an array of bits. The bits are stored as usual in an array of unsigned longs, but HBitmap is also optimized to provide fast iteration over set bits; going from one bit to the next is O(logB n) worst case, with B = sizeof(long) *