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
 */

Paolo

Reply via email to