36 |
|
|
37 |
typedef unsigned int bitset_attrs; |
typedef unsigned int bitset_attrs; |
38 |
|
|
39 |
/* The contents of the structure should be considered to be private. |
/* The contents of the union should be considered to be private. |
40 |
While I would like to make this structure opaque, it needs to be |
While I would like to make this union opaque, it needs to be |
41 |
visible for the inline bit set/test functions. */ |
visible for the inline bit set/test functions, and for delegation |
42 |
struct bitset_struct |
to the proper implementation. */ |
43 |
|
union bitset_union |
44 |
{ |
{ |
45 |
|
/* This must be the first member of every other structure that is a |
46 |
|
member of this union. */ |
47 |
struct bbitset_struct b; |
struct bbitset_struct b; |
48 |
|
|
49 |
|
struct abitset_struct |
50 |
|
{ |
51 |
|
struct bbitset_struct b; |
52 |
|
bitset_bindex n_bits; /* Number of bits. */ |
53 |
|
bitset_word words[1]; /* The array of bits. */ |
54 |
|
} a; |
55 |
|
|
56 |
|
struct ebitset_struct |
57 |
|
{ |
58 |
|
struct bbitset_struct b; |
59 |
|
bitset_windex size; /* Number of elements. */ |
60 |
|
struct ebitset_elt_struct **elts; /* Expanding array of ptrs to elts. */ |
61 |
|
} e; |
62 |
|
|
63 |
|
struct lbitset_struct |
64 |
|
{ |
65 |
|
struct bbitset_struct b; |
66 |
|
struct lbitset_elt_struct *head; /* First element in linked list. */ |
67 |
|
struct lbitset_elt_struct *tail; /* Last element in linked list. */ |
68 |
|
} l; |
69 |
|
|
70 |
|
struct bitset_stats_struct |
71 |
|
{ |
72 |
|
struct bbitset_struct b; |
73 |
|
bitset bset; |
74 |
|
} s; |
75 |
}; |
}; |
76 |
|
|
77 |
|
|
87 |
|
|
88 |
|
|
89 |
/* Return bytes required for bitset of desired type and size. */ |
/* Return bytes required for bitset of desired type and size. */ |
90 |
extern size_t bitset_bytes PARAMS ((enum bitset_type, bitset_bindex)); |
extern size_t bitset_bytes PARAMS ((enum_bitset_type, bitset_bindex)); |
91 |
|
|
92 |
/* Initialise a bitset with desired type and size. */ |
/* Initialise a bitset with desired type and size. */ |
93 |
extern bitset bitset_init PARAMS ((bitset, bitset_bindex, enum bitset_type)); |
extern bitset bitset_init PARAMS ((bitset, bitset_bindex, enum_bitset_type)); |
94 |
|
|
95 |
/* Select an implementation type based on the desired bitset size |
/* Select an implementation type based on the desired bitset size |
96 |
and attributes. */ |
and attributes. */ |
98 |
bitset_attrs)); |
bitset_attrs)); |
99 |
|
|
100 |
/* Create a bitset of desired type and size. The bitset is zeroed. */ |
/* Create a bitset of desired type and size. The bitset is zeroed. */ |
101 |
extern bitset bitset_alloc PARAMS ((bitset_bindex, enum bitset_type)); |
extern bitset bitset_alloc PARAMS ((bitset_bindex, enum_bitset_type)); |
102 |
|
|
103 |
/* Free bitset. */ |
/* Free bitset. */ |
104 |
extern void bitset_free PARAMS ((bitset)); |
extern void bitset_free PARAMS ((bitset)); |
106 |
/* Create a bitset of desired type and size using an obstack. The |
/* Create a bitset of desired type and size using an obstack. The |
107 |
bitset is zeroed. */ |
bitset is zeroed. */ |
108 |
extern bitset bitset_obstack_alloc PARAMS ((struct obstack *bobstack, |
extern bitset bitset_obstack_alloc PARAMS ((struct obstack *bobstack, |
109 |
bitset_bindex, enum bitset_type)); |
bitset_bindex, enum_bitset_type)); |
110 |
|
|
111 |
/* Free bitset allocated on obstack. */ |
/* Free bitset allocated on obstack. */ |
112 |
extern void bitset_obstack_free PARAMS ((bitset)); |
extern void bitset_obstack_free PARAMS ((bitset)); |
317 |
BITSET_LIST_REVERSE_ (BSET, LIST, NUM, NEXT) |
BITSET_LIST_REVERSE_ (BSET, LIST, NUM, NEXT) |
318 |
|
|
319 |
|
|
320 |
|
/* Find next set bit. */ |
321 |
|
extern bitset_bindex bitset_next PARAMS ((bitset, bitset_bindex)); |
322 |
|
|
323 |
|
/* Find previous set bit. */ |
324 |
|
extern bitset_bindex bitset_prev PARAMS ((bitset, bitset_bindex)); |
325 |
|
|
326 |
/* Find first set bit. */ |
/* Find first set bit. */ |
327 |
extern bitset_bindex bitset_first PARAMS ((bitset)); |
extern bitset_bindex bitset_first PARAMS ((bitset)); |
328 |
|
|
329 |
/* Find last set bit. */ |
/* Find last set bit. */ |
330 |
extern bitset_bindex bitset_last PARAMS ((bitset)); |
extern bitset_bindex bitset_last PARAMS ((bitset)); |
331 |
|
|
332 |
|
/* Return nonzero if this is the only set bit. */ |
333 |
|
extern int bitset_only_set_p PARAMS ((bitset, bitset_bindex)); |
334 |
|
|
335 |
/* Dump bitset. */ |
/* Dump bitset. */ |
336 |
extern void bitset_dump PARAMS ((FILE *, bitset)); |
extern void bitset_dump PARAMS ((FILE *, bitset)); |
337 |
|
|