45cef215036c2e912d2e4ee5471af447e7185949
[platform/upstream/libsolv.git] / src / bitmap.h
1 /*
2  * Copyright (c) 2007, Novell Inc.
3  *
4  * This program is licensed under the BSD license, read LICENSE.BSD
5  * for further information
6  */
7
8 /*
9  * bitmap.h
10  * 
11  */
12
13 #ifndef SATSOLVER_BITMAP_H
14 #define SATSOLVER_BITMAP_H
15
16 typedef struct _Map {
17   unsigned char *map;
18   int size;
19 } Map;
20
21 #define MAPZERO(m) (memset((m)->map, 0, (m)->size))
22 #define MAPSET(m, n) ((m)->map[(n) >> 3] |= 1 << ((n) & 7)) // Set Bit
23 #define MAPCLR(m, n) ((m)->map[(n) >> 3] &= ~(1 << ((n) & 7))) // Reset Bit
24 #define MAPTST(m, n) ((m)->map[(n) >> 3] & (1 << ((n) & 7))) // Test Bit
25
26 static inline void
27 map_empty(Map *m)
28 {
29   MAPZERO(m);
30 }
31
32 extern void map_init(Map *m, int n);
33 extern void map_init_clone(Map *t, Map *s);
34 extern void map_free(Map *m);
35
36 #endif /* SATSOLVER_BITMAP_H */