#include #include #include #include #define MAX_BLOCKS 512 typedef struct { char* bitmap; size_t bitmap_byt_size; size_t bitmap_bit_size; size_t avail_data_size; void* data_block; } heap_block; static heap_block entries[MAX_BLOCKS]; static size_t num_used_entries=0; static char get_bmap_bit(char* bmap,size_t index) { size_t byte=index/8; size_t bit=index%8; char entry=bmap[byte]; return (entry&(1<0; } static void set_bmap_bit(char* bmap,size_t index) { size_t byte=index/8; size_t bit=index%8; bmap[byte]=bmap[byte]|(1<=size) { char* bmap=entry.bitmap; size_t bmap_byt_sz=entry.bitmap_byt_size; for(size_t i=0;i