summaryrefslogtreecommitdiff
path: root/source3/lib/bitmap.c
diff options
context:
space:
mode:
Diffstat (limited to 'source3/lib/bitmap.c')
-rw-r--r--source3/lib/bitmap.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/source3/lib/bitmap.c b/source3/lib/bitmap.c
index f67ea994e5..ab84a2a84e 100644
--- a/source3/lib/bitmap.c
+++ b/source3/lib/bitmap.c
@@ -43,7 +43,7 @@ struct bitmap *bitmap_allocate(int n)
return NULL;
}
- memset(bm->b, 0, sizeof(bm->b[0])*bm->n);
+ memset(bm->b, 0, sizeof(bm->b[0])*(n+31)/32);
return bm;
}
@@ -70,6 +70,16 @@ BOOL bitmap_set(struct bitmap *bm, unsigned i)
}
/****************************************************************************
+clear a bit in a bitmap
+****************************************************************************/
+BOOL bitmap_clear(struct bitmap *bm, unsigned i)
+{
+ if (i >= bm->n) return False;
+ bm->b[i/32] &= ~(1<<(i%32));
+ return True;
+}
+
+/****************************************************************************
query a bit in a bitmap
****************************************************************************/
BOOL bitmap_query(struct bitmap *bm, unsigned i)