The new allocator and a new bitmap management subsystem.
[cacao.git] / mm / bitmap2.h
1 /* 
2  * cacao/mm/bitmap.h
3  * $Id: bitmap2.h 34 1998-11-03 11:29:37Z phil $ 
4  */
5
6 #ifndef __mm_bitmap_h_
7 #define __mm_bitmap_h_
8
9 #include "mm.h"
10
11 #if U8_AVAILABLE
12 #   define BITBLOCK             u8
13 #       define OFFSET_T         u8
14 #else
15 #       define BITBLOCK         u4
16 #       define OFFSET_T         u4
17 #endif
18
19 typedef struct {
20         BITBLOCK*           bitmap;                     /* accessor, usually copied */
21         unsigned long   bytesize;       /* used internally */
22         void*           bitmap_beyond_addr;
23         OFFSET_T                bitmap_top_block;
24         void*           bitmap_memory;  /* internal: the real address */
25 } bitmap_t;
26
27 inline void             bitmap_setbit(BITBLOCK* bitmap, void* addr);
28 inline void             bitmap_clearbit(BITBLOCK* bitmap, void* addr);
29 inline bool             bitmap_testbit(BITBLOCK* bitmap, void* addr);
30
31 inline void             bitmap_checking_setbit(bitmap_t* bitmap, void* addr);
32 inline void             bitmap_checking_clearbit(bitmap_t* bitmap, void* addr);
33 inline bool             bitmap_checking_testbit(bitmap_t* bitmap, void* addr);
34
35 inline void                     bitmap_clear(bitmap_t* bitmap);
36 inline bitmap_t*        bitmap_allocate(void* zero_offset, OFFSET_T size);
37 inline void             bitmap_release(bitmap_t* bitmap);
38
39 inline void*            bitmap_find_next_setbit(bitmap_t* bitmap, void* addr);
40 inline void*            bitmap_find_next_combination_set_unset(bitmap_t* bitmap, bitmap_t* invertedmap, void* addr);
41
42 #endif
43
44 /*
45  * These are local overrides for various environment variables in Emacs.
46  * Please do not remove this and leave it at the end of the file, where
47  * Emacs will automagically detect them.
48  * ---------------------------------------------------------------------
49  * Local variables:
50  * mode: c
51  * indent-tabs-mode: t
52  * c-basic-offset: 4
53  * tab-width: 4
54  * End:
55  */