#ifndef _JOVE_LIB_BITMAP_H #define _JOVE_LIB_BITMAP_H 1 #include #include typedef unsigned char bitmap_block_t; #define BITMAP_BLOCK_BITS (sizeof(bitmap_block_t) * 8) struct bitmap { unsigned int total_bits; unsigned int free_bits; unsigned int last_free_bit; bitmap_block_t data[]; }; extern bool bitmap_check(struct bitmap *bitmap, size_t idx); extern void bitmap_set(struct bitmap *bitmap, size_t idx); extern void bitmap_unset(struct bitmap *bitmap, size_t idx); int bitmap_findfree(struct bitmap *bitmap); int bitmap_findfree_contig(struct bitmap *bitmap, size_t size); #endif