- bring argument parsing up-to-speed, now supports globs, relations
[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 #include <string.h>
17
18 typedef struct _Map {
19   unsigned char *map;
20   int size;
21 } Map;
22
23 #define MAPZERO(m) (memset((m)->map, 0, (m)->size))
24 #define MAPSET(m, n) ((m)->map[(n) >> 3] |= 1 << ((n) & 7)) // Set Bit
25 #define MAPCLR(m, n) ((m)->map[(n) >> 3] &= ~(1 << ((n) & 7))) // Reset Bit
26 #define MAPTST(m, n) ((m)->map[(n) >> 3] & (1 << ((n) & 7))) // Test Bit
27
28 static inline void
29 map_empty(Map *m)
30 {
31   MAPZERO(m);
32 }
33
34 extern void map_init(Map *m, int n);
35 extern void map_init_clone(Map *t, Map *s);
36 extern void map_grow(Map *m, int n);
37 extern void map_free(Map *m);
38
39 #endif /* SATSOLVER_BITMAP_H */