X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2Fbitmap.h;h=5784e6c0139c04e00048e19967d715db9b367b73;hb=bbdec95b275a74bd44244ba6a1d93e0fc21ef810;hp=45cef215036c2e912d2e4ee5471af447e7185949;hpb=e38c7e94df5cf9a3efd4e3b4bab6bddc1214a2b9;p=platform%2Fupstream%2Flibsolv.git diff --git a/src/bitmap.h b/src/bitmap.h index 45cef21..5784e6c 100644 --- a/src/bitmap.h +++ b/src/bitmap.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, Novell Inc. + * Copyright (c) 2007-2011, Novell Inc. * * This program is licensed under the BSD license, read LICENSE.BSD * for further information @@ -7,11 +7,17 @@ /* * bitmap.h - * + * */ -#ifndef SATSOLVER_BITMAP_H -#define SATSOLVER_BITMAP_H +#ifndef LIBSOLV_BITMAP_H +#define LIBSOLV_BITMAP_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif typedef struct _Map { unsigned char *map; @@ -19,18 +25,46 @@ typedef struct _Map { } Map; #define MAPZERO(m) (memset((m)->map, 0, (m)->size)) -#define MAPSET(m, n) ((m)->map[(n) >> 3] |= 1 << ((n) & 7)) // Set Bit -#define MAPCLR(m, n) ((m)->map[(n) >> 3] &= ~(1 << ((n) & 7))) // Reset Bit -#define MAPTST(m, n) ((m)->map[(n) >> 3] & (1 << ((n) & 7))) // Test Bit +/* set all bits */ +#define MAPSETALL(m) (memset((m)->map, 0xff, (m)->size)) +/* set bit */ +#define MAPSET(m, n) ((m)->map[(n) >> 3] |= 1 << ((n) & 7)) +/* clear bit */ +#define MAPCLR(m, n) ((m)->map[(n) >> 3] &= ~(1 << ((n) & 7))) +/* test bit */ +#define MAPTST(m, n) ((m)->map[(n) >> 3] & (1 << ((n) & 7))) + +extern void map_init(Map *m, int n); +extern void map_init_clone(Map *t, Map *s); +extern void map_grow(Map *m, int n); +extern void map_free(Map *m); +extern void map_and(Map *t, Map *s); +extern void map_or(Map *t, Map *s); +extern void map_subtract(Map *t, Map *s); -static inline void -map_empty(Map *m) +static inline void map_empty(Map *m) { MAPZERO(m); } +static inline void map_set(Map *m, int n) +{ + MAPSET(m, n); +} +static inline void map_setall(Map *m) +{ + MAPSETALL(m); +} +static inline void map_clr(Map *m, int n) +{ + MAPCLR(m, n); +} +static inline int map_tst(Map *m, int n) +{ + return MAPTST(m, n); +} -extern void map_init(Map *m, int n); -extern void map_init_clone(Map *t, Map *s); -extern void map_free(Map *m); +#ifdef __cplusplus +} +#endif -#endif /* SATSOLVER_BITMAP_H */ +#endif /* LIBSOLV_BITMAP_H */