1 #ifndef __MONO_BITSET_H__
2 #define __MONO_BITSET_H__
6 typedef struct MonoBitSet MonoBitSet
;
7 typedef void (*MonoBitSetFunc
) (guint idx
, gpointer data
);
10 MONO_BITSET_DONT_FREE
= 1
13 #define MONO_BITSET_BITS_PER_CHUNK (8 * sizeof (gsize))
15 /* Fast access to bits which depends on the implementation of the bitset */
16 #define mono_bitset_test_fast(set,n) (((gsize*)set)[2+(n)/MONO_BITSET_BITS_PER_CHUNK] & ((gsize)1 << ((n) % MONO_BITSET_BITS_PER_CHUNK)))
17 #define mono_bitset_set_fast(set,n) do { ((gsize*)set)[2+(n)/MONO_BITSET_BITS_PER_CHUNK] |= ((gsize)1 << ((n) % MONO_BITSET_BITS_PER_CHUNK)); } while (0)
18 #define mono_bitset_clear_fast(set,n) do { ((gsize*)set)[2+(n)/MONO_BITSET_BITS_PER_CHUNK] &= ~((gsize)1 << ((n) % MONO_BITSET_BITS_PER_CHUNK)); } while (0)
19 #define mono_bitset_get_fast(set,n) (((gsize*)set)[2+(n)])
22 * Interface documentation can be found in the c-file.
23 * Interface documentation by Dennis Haney.
26 guint32
mono_bitset_alloc_size (guint32 max_size
, guint32 flags
);
28 MonoBitSet
* mono_bitset_new (guint32 max_size
, guint32 flags
);
30 MonoBitSet
* mono_bitset_mem_new (gpointer mem
, guint32 max_size
, guint32 flags
);
32 void mono_bitset_free (MonoBitSet
*set
);
34 void mono_bitset_set (MonoBitSet
*set
, guint32 pos
);
36 void mono_bitset_set_all (MonoBitSet
*set
);
38 int mono_bitset_test (const MonoBitSet
*set
, guint32 pos
);
40 gsize
mono_bitset_test_bulk (const MonoBitSet
*set
, guint32 pos
);
42 void mono_bitset_clear (MonoBitSet
*set
, guint32 pos
);
44 void mono_bitset_clear_all (MonoBitSet
*set
);
46 void mono_bitset_invert (MonoBitSet
*set
);
48 guint32
mono_bitset_size (const MonoBitSet
*set
);
50 guint32
mono_bitset_count (const MonoBitSet
*set
);
52 void mono_bitset_low_high (const MonoBitSet
*set
, guint32
*low
, guint32
*high
);
54 int mono_bitset_find_start (const MonoBitSet
*set
);
56 int mono_bitset_find_first (const MonoBitSet
*set
, gint pos
);
58 int mono_bitset_find_last (const MonoBitSet
*set
, gint pos
);
60 int mono_bitset_find_first_unset (const MonoBitSet
*set
, gint pos
);
62 MonoBitSet
* mono_bitset_clone (const MonoBitSet
*set
, guint32 new_size
);
64 void mono_bitset_copyto (const MonoBitSet
*src
, MonoBitSet
*dest
);
66 void mono_bitset_union (MonoBitSet
*dest
, const MonoBitSet
*src
);
68 void mono_bitset_intersection (MonoBitSet
*dest
, const MonoBitSet
*src
);
70 void mono_bitset_sub (MonoBitSet
*dest
, const MonoBitSet
*src
);
72 gboolean
mono_bitset_equal (const MonoBitSet
*src
, const MonoBitSet
*src1
);
74 void mono_bitset_foreach (MonoBitSet
*set
, MonoBitSetFunc func
, gpointer data
);
76 void mono_bitset_intersection_2 (MonoBitSet
*dest
, const MonoBitSet
*src1
, const MonoBitSet
*src2
);
78 #endif /* __MONO_BITSET_H__ */