merge -r 53370:58178
[mono.git] / mono / utils / monobitset.h
1 #ifndef __MONO_BITSET_H__
2 #define __MONO_BITSET_H__
3
4 #include <glib.h>
5
6 typedef struct MonoBitSet MonoBitSet;
7 typedef void (*MonoBitSetFunc) (guint idx, gpointer data);
8
9 enum {
10         MONO_BITSET_DONT_FREE = 1
11 };
12
13 /*
14  * Interface documentation can be found in the c-file.
15  * Interface documentation by Dennis Haney.
16  */
17
18 guint32     mono_bitset_alloc_size   (guint32 max_size, guint32 flags);
19
20 MonoBitSet* mono_bitset_new          (guint32 max_size, guint32 flags);
21
22 MonoBitSet* mono_bitset_mem_new      (gpointer mem, guint32 max_size, guint32 flags);
23
24 void        mono_bitset_free         (MonoBitSet *set); 
25
26 void        mono_bitset_set          (MonoBitSet *set, guint32 pos);
27
28 void        mono_bitset_set_all      (MonoBitSet *set);
29
30 int         mono_bitset_test         (const MonoBitSet *set, guint32 pos);
31
32 guint32     mono_bitset_test_bulk    (const MonoBitSet *set, guint32 pos);
33
34 void        mono_bitset_clear        (MonoBitSet *set, guint32 pos);
35
36 void        mono_bitset_clear_all    (MonoBitSet *set);
37
38 void        mono_bitset_invert       (MonoBitSet *set);
39
40 guint32     mono_bitset_size         (const MonoBitSet *set);
41
42 guint32     mono_bitset_count        (const MonoBitSet *set);
43
44 void        mono_bitset_low_high     (const MonoBitSet *set, guint32 *low, guint32 *high);
45
46 int         mono_bitset_find_start   (const MonoBitSet *set);
47
48 int         mono_bitset_find_first   (const MonoBitSet *set, gint pos);
49
50 int         mono_bitset_find_last    (const MonoBitSet *set, gint pos);
51
52 MonoBitSet* mono_bitset_clone        (const MonoBitSet *set, guint32 new_size);
53
54 void        mono_bitset_copyto       (const MonoBitSet *src, MonoBitSet *dest);
55
56 void        mono_bitset_union        (MonoBitSet *dest, const MonoBitSet *src);
57
58 void        mono_bitset_intersection (MonoBitSet *dest, const MonoBitSet *src);
59
60 void        mono_bitset_sub          (MonoBitSet *dest, const MonoBitSet *src);
61
62 gboolean    mono_bitset_equal        (const MonoBitSet *src, const MonoBitSet *src1);
63
64 void        mono_bitset_foreach      (MonoBitSet *set, MonoBitSetFunc func, gpointer data);
65
66 #endif /* __MONO_BITSET_H__ */