diff options
Diffstat (limited to 'ewah')
-rw-r--r-- | ewah/bitmap.c | 8 | ||||
-rw-r--r-- | ewah/ewok.h | 1 |
2 files changed, 9 insertions, 0 deletions
diff --git a/ewah/bitmap.c b/ewah/bitmap.c index b5fed9621f..d8cec585af 100644 --- a/ewah/bitmap.c +++ b/ewah/bitmap.c @@ -50,6 +50,14 @@ void bitmap_set(struct bitmap *self, size_t pos) self->words[block] |= EWAH_MASK(pos); } +void bitmap_unset(struct bitmap *self, size_t pos) +{ + size_t block = EWAH_BLOCK(pos); + + if (block < self->word_alloc) + self->words[block] &= ~EWAH_MASK(pos); +} + int bitmap_get(struct bitmap *self, size_t pos) { size_t block = EWAH_BLOCK(pos); diff --git a/ewah/ewok.h b/ewah/ewok.h index 1b98b57c8b..011852bef1 100644 --- a/ewah/ewok.h +++ b/ewah/ewok.h @@ -174,6 +174,7 @@ struct bitmap { struct bitmap *bitmap_new(void); struct bitmap *bitmap_word_alloc(size_t word_alloc); void bitmap_set(struct bitmap *self, size_t pos); +void bitmap_unset(struct bitmap *self, size_t pos); int bitmap_get(struct bitmap *self, size_t pos); void bitmap_reset(struct bitmap *self); void bitmap_free(struct bitmap *self); |