[Top][All Lists]

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

Re: [Qemu-block] [Qemu-devel] [PATCH for 2.6 1/3] backup: Use Bitmap to

From: Paolo Bonzini
Subject: Re: [Qemu-block] [Qemu-devel] [PATCH for 2.6 1/3] backup: Use Bitmap to replace "s->bitmap"
Date: Mon, 23 Nov 2015 15:49:58 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0

On 23/11/2015 10:55, Fam Zheng wrote:
>>> Why? I think bitmap_set is a better match with bitmap_new below.
>> set_bit() is quicker than bitmap_set() if you only set one bit.
> How much quicker is it? This doesn't sound convincing enough for me to lose 
> the
> readability.

Substantially.  It's also documented:

 * Also the following operations apply to bitmaps.
 * set_bit(bit, addr)                   *addr |= bit
 * clear_bit(bit, addr)                 *addr &= ~bit
 * change_bit(bit, addr)                *addr ^= bit
 * test_bit(bit, addr)                  Is bit set in *addr?
 * test_and_set_bit(bit, addr)          Set bit and return old value
 * test_and_clear_bit(bit, addr)        Clear bit and return old value
 * test_and_change_bit(bit, addr)       Change bit and return old value
 * find_first_zero_bit(addr, nbits)     Position first zero bit in *addr
 * find_first_bit(addr, nbits)          Position first set bit in *addr
 * find_next_zero_bit(addr, nbits, bit) Position next zero bit in *addr >= bit
 * find_next_bit(addr, nbits, bit)      Position next set bit in *addr >= bit


reply via email to

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