diff options
Diffstat (limited to 'src/bitmap.c')
-rw-r--r-- | src/bitmap.c | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/src/bitmap.c b/src/bitmap.c new file mode 100644 index 0000000..e8ce806 --- /dev/null +++ b/src/bitmap.c @@ -0,0 +1,36 @@ +/* + * bitmap.c + * + */ + +#include <stdlib.h> +#include <string.h> + +#include "bitmap.h" + +void +mapinit(Map *m, int n) +{ + m->size = (n + 7) >> 3; + m->map = calloc(m->size, 1); +} + +// free space allocated +void +mapfree(Map *m) +{ + free(m->map); + m->map = 0; + m->size = 0; +} + +// copy t <- s +void +clonemap(Map *t, Map *s) +{ + t->size = s->size; + t->map = malloc(s->size); + memcpy(t->map, s->map, t->size); +} + +// EOF |