1 /* Copyright (c) 2010, 2014. The SimGrid Team.
2 * All rights reserved. */
4 /* This program is free software; you can redistribute it and/or modify it
5 * under the terms of the license (GNU LGPL) which comes with this package. */
9 #include "xbt/setset.h"
12 #define BITS_INT (8 * sizeof(int))
14 typedef struct s_xbt_setset_elm {
16 } s_xbt_setset_elm_t, *xbt_setset_elm_t;
18 typedef union u_xbt_setset_elm_entry {
19 /* Information when the entry is being used */
23 /* Information when the entry is free */
27 } u_xbt_setset_elm_entry_t, *xbt_setset_elm_entry_t;
29 typedef struct s_xbt_setset_set {
30 xbt_setset_t setset; /* setset that contains this set */
31 unsigned int size; /* in integers */
32 unsigned int *bitmap; /* the bit array */
35 typedef struct s_xbt_setset {
36 xbt_dynar_t elm_array; /* of s_xbt_setset_elm_entry_t, to find elements by index */
37 xbt_fifo_t sets; /* of s_xbt_setset_set_t, memberships in actual sets of setset */
40 typedef struct s_xbt_setset_cursor {
41 int idx; /* Actual postition of the cursor (bit number) */
42 xbt_setset_set_t set; /* The set associated to the cursor */
43 } s_xbt_setset_cursor_t;
45 /* Some internal functions */
49 /* Get the object associated to a given index */
50 void *_xbt_setset_idx_to_obj(xbt_setset_t setset, unsigned long idx);
52 /* Check if the nth bit of an integer is set or not*/
53 unsigned int _is_bit_set(unsigned int bit, unsigned int integer);
55 /* Set the nth bit of an array of integers */
56 void _set_bit(unsigned int bit, unsigned int *bitmap);
58 /* Unset the nth bit of an array of integers */
59 void _unset_bit(unsigned int bit, unsigned int *bitmap);