1 #ifndef HEADER_BITMAP_H
2 #define HEADER_BITMAP_H 1
7 typedef unsigned long elem_type;
15 bool bitmap_init (struct bitmap *, size_t bit_cnt);
16 void bitmap_destroy (struct bitmap *);
18 size_t bitmap_size (const struct bitmap *);
19 size_t bitmap_storage_size (const struct bitmap *);
21 void bitmap_set (struct bitmap *, size_t idx, bool);
22 void bitmap_set_all (struct bitmap *, bool);
24 void bitmap_mark (struct bitmap *, size_t idx);
25 void bitmap_reset (struct bitmap *, size_t idx);
26 void bitmap_flip (struct bitmap *, size_t idx);
28 bool bitmap_test (const struct bitmap *, size_t idx);
30 #define BITMAP_ERROR ((size_t) -1)
31 size_t bitmap_scan (const struct bitmap *, bool);
32 size_t bitmap_find_and_set (struct bitmap *);
33 size_t bitmap_find_and_clear (struct bitmap *);
35 size_t bitmap_set_cnt (const struct bitmap *);
36 bool bitmap_clear_cnt (const struct bitmap *);
38 bool bitmap_any (const struct bitmap *);
39 bool bitmap_none (const struct bitmap *);
40 bool bitmap_all (const struct bitmap *);
44 void bitmap_read (struct bitmap *, struct file *);
45 void bitmap_write (const struct bitmap *, struct file *);