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