ldivmod, uldivmod: fix qdivrem calls
[minix.git] / include / minix / bitmap.h
blob7a4b74a9aba67901824afa2d44933f7dd123a893
1 #ifndef _BITMAP_H
2 #define _BITMAP_H
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__)
21 #ifndef __ASSEMBLY__
22 static inline bits_fill(bitchunk_t * chunks, unsigned bits)
24 unsigned c, cnt;
26 cnt = BITMAP_CHUNKS(bits);
27 for (c = 0; c < cnt; c++)
28 bit_fill(chunks[c]);
30 #endif
31 #endif
34 #endif /* _BITMAP_H */