Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
oups! forgot to rest some parts ...
[simgrid.git] / src / xbt / setset_private.h
1 #include "xbt/dict.h"
2 #include "xbt/dynar.h"
3 #include "xbt/setset.h"
4 #include "xbt/fifo.h"
5
6 #define BITS_INT (8 * sizeof(int))
7
8 typedef struct s_xbt_setset_elm {
9   XBT_SETSET_HEADERS;
10 } s_xbt_setset_elm_t, *xbt_setset_elm_t;
11
12 typedef union u_xbt_setset_elm_entry {
13   /* Information when the entry is being used */
14   struct {
15     xbt_setset_elm_t obj;
16   } info;
17   /* Information when the entry is free */
18   struct {
19     unsigned long next;
20   } free;
21 } u_xbt_setset_elm_entry_t, *xbt_setset_elm_entry_t;
22
23 typedef struct s_xbt_setset_set {
24   xbt_setset_t setset;          /* setset that contains this set */
25   unsigned int size;            /* in integers */
26   unsigned int *bitmap;         /* the bit array */
27 } s_xbt_setset_set_t;
28
29 typedef struct s_xbt_setset {
30   xbt_dynar_t elm_array;        /* of s_xbt_setset_elm_entry_t, to find elements by index */
31   xbt_fifo_t sets;              /* of s_xbt_setset_set_t, memberships in actual sets of setset */
32 } s_xbt_setset_t;
33
34 typedef struct s_xbt_setset_cursor {
35   int idx;                      /* Actual postition of the cursor (bit number) */
36   xbt_setset_set_t set;         /* The set associated to the cursor */
37 } s_xbt_setset_cursor_t;
38
39 /* Some internal functions */
40
41 int bitcount(int);
42
43 /* Get the object associated to a given index */
44 void *_xbt_setset_idx_to_obj(xbt_setset_t setset, unsigned long idx);
45
46 /* Check if the nth bit of an integer is set or not*/
47 unsigned int _is_bit_set(unsigned int bit, unsigned int integer);
48
49 /* Set the nth bit of an array of integers */
50 void _set_bit(unsigned int bit, unsigned int *bitmap);
51
52 /* Unset the nth bit of an array of integers */
53 void _unset_bit(unsigned int bit, unsigned int *bitmap);