4 /* Bit map operations to manipulate bits of a simple mask variable. */
5 #define bit_set(mask, n) ((mask) |= (1 << (n)))
6 #define bit_unset(mask, n) ((mask) &= ~(1 << (n)))
7 #define bit_isset(mask, n) ((mask) & (1 << (n)))
8 #define bit_empty(mask) ((mask) = 0)
9 #define bit_fill(mask) ((mask) = ~0)
11 /* Definitions previously in kernel/const.h */
12 #define BITCHUNK_BITS (sizeof(bitchunk_t) * CHAR_BIT)
13 #define BITMAP_CHUNKS(nr_bits) (((nr_bits)+BITCHUNK_BITS-1)/BITCHUNK_BITS)
14 #define MAP_CHUNK(map,bit) (map)[((bit)/BITCHUNK_BITS)]
15 #define CHUNK_OFFSET(bit) ((bit)%BITCHUNK_BITS)
16 #define GET_BIT(map,bit) ( MAP_CHUNK(map,bit) & (1 << CHUNK_OFFSET(bit) ))
17 #define SET_BIT(map,bit) ( MAP_CHUNK(map,bit) |= (1 << CHUNK_OFFSET(bit) ))
18 #define UNSET_BIT(map,bit) ( MAP_CHUNK(map,bit) &= ~(1 << CHUNK_OFFSET(bit) ))
20 #if defined(CONFIG_SMP) && defined(__GNUC__)
22 static inline bits_fill(bitchunk_t
* chunks
, unsigned bits
)
26 cnt
= BITMAP_CHUNKS(bits
);
27 for (c
= 0; c
< cnt
; c
++)
34 #endif /* _BITMAP_H */