summaryrefslogtreecommitdiff
path: root/ewah
diff options
context:
space:
mode:
Diffstat (limited to 'ewah')
-rw-r--r--ewah/bitmap.c8
-rw-r--r--ewah/ewok.h1
2 files changed, 9 insertions, 0 deletions
diff --git a/ewah/bitmap.c b/ewah/bitmap.c
index 52f1178..1c31b3e 100644
--- a/ewah/bitmap.c
+++ b/ewah/bitmap.c
@@ -45,6 +45,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 84b2a29..59f4ef7 100644
--- a/ewah/ewok.h
+++ b/ewah/ewok.h
@@ -173,6 +173,7 @@ struct bitmap {
struct bitmap *bitmap_new(void);
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);