Loading...
Searching...
No Matches
Go to the documentation of this file.
4#define BITS_TO_LONGS(nr) (((nr) + BITS_PER_LONG - 1) / BITS_PER_LONG)
6#define DECLARE_BITMAP(name, bits) \
7 unsigned long name[BITS_TO_LONGS(bits)]
9#define set_bit(nr, addr) \
10 ((addr)[(nr) / BITS_PER_LONG] |= (1UL << ((nr) % BITS_PER_LONG)))
12#define clear_bit(nr, addr) \
13 ((addr)[(nr) / BITS_PER_LONG] &= ~(1UL << ((nr) % BITS_PER_LONG)))
15#define test_bit(nr, addr) \
16 (!!((addr)[(nr) / BITS_PER_LONG] & (1UL << ((nr) % BITS_PER_LONG))))
18#define test_and_set_bit(nr, addr) \
19 ({int __old = test_bit(nr, addr); set_bit(nr, addr); __old; })
21#define test_and_clear_bit(nr,addr) \
22 ({ int __old = test_bit(nr, addr); clear_bit(nr,addr); __old;})
24#define bitmap_zero(dst, nbits) \
25 memset(dst, 0, BITS_TO_LONGS(nbits) * sizeof(unsigned long))
27#define bitmap_copy(dst, src, nbits) \
28 memcpy(dst, src, BITS_TO_LONGS(nbits) * sizeof(unsigned long))