1 /* Functions to support link list bitsets.
2 Copyright (C) 2002 Free Software Foundation, Inc.
3 Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz).
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
28 # define DMALLOC_FUNC_CHECK
30 # endif /* WITH_DMALLOC */
32 /* This file implements linked-list bitsets. These bitsets can be of
33 arbitrary length and are more efficient than arrays of bits for
36 Usually if all the bits in an element are zero we remove the element
37 from the list. However, a side effect of the bit caching is that we
38 do not always notice when an element becomes zero. Hence the
39 lbitset_weed function which removes zero elements. */
41 enum lbitset_find_mode
{LBITSET_FIND
, LBITSET_CREATE
, LBITSET_SUBST
};
43 static lbitset_elt lbitset_zero_elts
[3]; /* Elements of all zero bits. */
45 /* Obstack to allocate bitset elements from. */
46 static struct obstack lbitset_obstack
;
47 static int lbitset_obstack_init
= 0;
48 static lbitset_elt
*lbitset_free_list
; /* Free list of bitset elements. */
50 static lbitset_elt
*lbitset_elt_alloc
PARAMS ((void));
51 static lbitset_elt
*lbitset_elt_calloc
PARAMS ((void));
52 static void lbitset_elt_link
PARAMS ((bitset
, lbitset_elt
*));
53 static void lbitset_elt_unlink
PARAMS ((bitset
, lbitset_elt
*));
54 static void lbitset_elt_free
PARAMS ((lbitset_elt
*));
55 static lbitset_elt
*lbitset_elt_find
PARAMS ((bitset
, bitset_windex
,
56 enum lbitset_find_mode
));
57 static int lbitset_elt_zero_p
PARAMS ((lbitset_elt
*));
59 static void lbitset_prune
PARAMS ((bitset
, lbitset_elt
*));
60 static void lbitset_weed
PARAMS ((bitset
));
61 static void lbitset_zero
PARAMS((bitset
));
62 static int lbitset_equal_p
PARAMS((bitset
, bitset
));
63 static void lbitset_copy
PARAMS((bitset
, bitset
));
64 static int lbitset_copy_compare
PARAMS((bitset
, bitset
));
65 static void lbitset_set
PARAMS((bitset
, bitset_bindex
));
66 static void lbitset_reset
PARAMS((bitset
, bitset_bindex
));
67 static int lbitset_test
PARAMS((bitset
, bitset_bindex
));
68 static int lbitset_size
PARAMS((bitset
));
69 static int lbitset_op1
PARAMS((bitset
, enum bitset_ops
));
70 static int lbitset_op2
PARAMS((bitset
, bitset
, enum bitset_ops
));
71 static int lbitset_op3
PARAMS((bitset
, bitset
, bitset
, enum bitset_ops
));
72 static int lbitset_op4
PARAMS((bitset
, bitset
, bitset
, bitset
,
74 static int lbitset_list
PARAMS((bitset
, bitset_bindex
*, bitset_bindex
,
76 static int lbitset_reverse_list
PARAMS((bitset
, bitset_bindex
*, bitset_bindex
,
78 static void lbitset_free
PARAMS((bitset
));
81 #define LBITSET_CURRENT1(X) (lbitset_elt *)((char *)(X) + ((char *)&(((lbitset_elt *)(X))->next) - (char *)&(((lbitset_elt *)(X))->words)))
83 #define LBITSET_CURRENT(X) LBITSET_CURRENT1((X)->cdata)
85 #define LBITSET_HEAD(X) ((X)->u.l.head)
86 #define LBITSET_TAIL(X) ((X)->u.l.tail)
88 /* Allocate a lbitset element. The bits are not cleared. */
89 static inline lbitset_elt
*
94 if (lbitset_free_list
!= 0)
96 elt
= lbitset_free_list
;
97 lbitset_free_list
= elt
->next
;
101 /* We can't use gcc_obstack_init to initialize the obstack since
102 print-rtl.c now calls bitset functions, and bitset is linked
103 into the gen* functions. */
104 if (!lbitset_obstack_init
)
106 lbitset_obstack_init
= 1;
108 /* Let particular systems override the size of a chunk. */
109 #ifndef OBSTACK_CHUNK_SIZE
110 #define OBSTACK_CHUNK_SIZE 0
112 /* Let them override the alloc and free routines too. */
113 #ifndef OBSTACK_CHUNK_ALLOC
114 #define OBSTACK_CHUNK_ALLOC xmalloc
116 #ifndef OBSTACK_CHUNK_FREE
117 #define OBSTACK_CHUNK_FREE free
120 #if !defined(__GNUC__) || (__GNUC__ < 2)
121 #define __alignof__(type) 0
124 obstack_specify_allocation (&lbitset_obstack
, OBSTACK_CHUNK_SIZE
,
125 __alignof__ (lbitset_elt
),
126 (void *(*) PARAMS ((long))) OBSTACK_CHUNK_ALLOC
,
127 (void (*) PARAMS ((void *))) OBSTACK_CHUNK_FREE
);
130 /* Perhaps we should add a number of new elements to the free
132 elt
= (lbitset_elt
*) obstack_alloc (&lbitset_obstack
,
133 sizeof (lbitset_elt
));
140 /* Allocate a lbitset element. The bits are not cleared. */
141 static inline lbitset_elt
*
142 lbitset_elt_calloc ()
146 elt
= lbitset_elt_alloc ();
147 memset (elt
->words
, 0, sizeof (elt
->words
));
153 lbitset_elt_free (elt
)
156 elt
->next
= lbitset_free_list
;
157 lbitset_free_list
= elt
;
161 /* Unlink element ELT from bitset BSET. */
163 lbitset_elt_unlink (bset
, elt
)
167 lbitset_elt
*next
= elt
->next
;
168 lbitset_elt
*prev
= elt
->prev
;
176 if (LBITSET_HEAD (bset
) == elt
)
177 LBITSET_HEAD (bset
) = next
;
178 if (LBITSET_TAIL (bset
) == elt
)
179 LBITSET_TAIL (bset
) = prev
;
181 /* Update cache pointer. Since the first thing we try is to insert
182 before current, make current the next entry in preference to the
184 if (LBITSET_CURRENT (bset
) == elt
)
188 bset
->cdata
= next
->words
;
189 bset
->cindex
= next
->index
;
193 bset
->cdata
= prev
->words
;
194 bset
->cindex
= prev
->index
;
203 lbitset_elt_free (elt
);
207 /* Cut the chain of bitset BSET before element ELT and free the
210 lbitset_prune (bset
, elt
)
221 LBITSET_TAIL (bset
) = elt
->prev
;
222 bset
->cdata
= elt
->prev
->words
;
223 bset
->cindex
= elt
->prev
->index
;
228 LBITSET_HEAD (bset
) = 0;
229 LBITSET_TAIL (bset
) = 0;
234 for (; elt
; elt
= next
)
237 lbitset_elt_free (elt
);
242 /* Return nonzero if all bits in an element are zero. */
244 lbitset_elt_zero_p (elt
)
249 for (i
= 0; i
< LBITSET_ELT_WORDS
; i
++)
257 /* Link the bitset element into the current bitset linked list. */
259 lbitset_elt_link (bset
, elt
)
263 bitset_windex index
= elt
->index
;
265 lbitset_elt
*current
;
268 current
= LBITSET_CURRENT (bset
);
270 current
= LBITSET_HEAD (bset
);
272 /* If this is the first and only element, add it in. */
273 if (LBITSET_HEAD (bset
) == 0)
275 elt
->next
= elt
->prev
= 0;
276 LBITSET_HEAD (bset
) = elt
;
277 LBITSET_TAIL (bset
) = elt
;
280 /* If this index is less than that of the current element, it goes
281 somewhere before the current element. */
282 else if (index
< bset
->cindex
)
285 ptr
->prev
&& ptr
->prev
->index
> index
;
290 ptr
->prev
->next
= elt
;
292 LBITSET_HEAD (bset
) = elt
;
294 elt
->prev
= ptr
->prev
;
299 /* Otherwise, it must go somewhere after the current element. */
303 ptr
->next
&& ptr
->next
->index
< index
;
308 ptr
->next
->prev
= elt
;
310 LBITSET_TAIL (bset
) = elt
;
312 elt
->next
= ptr
->next
;
317 /* Set up so this is the first element searched. */
318 bset
->cindex
= index
;
319 bset
->csize
= LBITSET_ELT_WORDS
;
320 bset
->cdata
= elt
->words
;
325 lbitset_elt_find (bset
, index
, mode
)
328 enum lbitset_find_mode mode
;
331 lbitset_elt
*current
;
335 current
= LBITSET_CURRENT (bset
);
336 /* Check if element is the cached element. */
337 if ((index
- bset
->cindex
) < bset
->csize
)
342 current
= LBITSET_HEAD (bset
);
347 if (index
< bset
->cindex
)
350 elt
->prev
&& elt
->index
> index
;
357 elt
->next
&& (elt
->index
+ LBITSET_ELT_WORDS
- 1) < index
;
362 /* `element' is the nearest to the one we want. If it's not the one
363 we want, the one we want does not exist. */
364 if (elt
&& (index
- elt
->index
) < LBITSET_ELT_WORDS
)
366 bset
->cindex
= elt
->index
;
367 bset
->csize
= LBITSET_ELT_WORDS
;
368 bset
->cdata
= elt
->words
;
379 index
= (index
/ (unsigned) LBITSET_ELT_WORDS
) * LBITSET_ELT_WORDS
;
381 elt
= lbitset_elt_calloc ();
383 lbitset_elt_link (bset
, elt
);
387 return &lbitset_zero_elts
[0];
395 /* Weed out the zero elements from the list. */
403 for (elt
= LBITSET_HEAD (bset
); elt
; elt
= next
)
406 if (lbitset_elt_zero_p (elt
))
407 lbitset_elt_unlink (bset
, elt
);
412 /* Set all bits in the bitset to zero. */
419 head
= LBITSET_HEAD (bset
);
423 /* Clear a bitset by freeing the linked list at the head element. */
424 lbitset_prune (bset
, head
);
429 lbitset_equal_p (dst
, src
)
442 for (selt
= LBITSET_HEAD (src
), delt
= LBITSET_HEAD (dst
);
443 selt
&& delt
; selt
= selt
->next
, delt
= delt
->next
)
445 if (selt
->index
!= delt
->index
)
448 for (j
= 0; j
< LBITSET_ELT_WORDS
; j
++)
449 if (delt
->words
[j
] != selt
->words
[j
])
452 return ! selt
&& ! delt
;
456 /* Copy bits from bitset SRC to bitset DST. */
458 lbitset_copy (dst
, src
)
472 head
= LBITSET_HEAD (src
);
477 for (elt
= head
; elt
; elt
= elt
->next
)
479 tmp
= lbitset_elt_alloc ();
480 tmp
->index
= elt
->index
;
486 LBITSET_HEAD (dst
) = tmp
;
489 memcpy (tmp
->words
, elt
->words
, sizeof (elt
->words
));
491 LBITSET_TAIL (dst
) = tmp
;
493 dst
->csize
= LBITSET_ELT_WORDS
;
494 dst
->cdata
= LBITSET_HEAD (dst
)->words
;
495 dst
->cindex
= LBITSET_HEAD (dst
)->index
;
499 /* Copy bits from bitset SRC to bitset DST. Return non-zero if
500 bitsets different. */
502 lbitset_copy_compare (dst
, src
)
509 if (! LBITSET_HEAD (dst
))
511 lbitset_copy (dst
, src
);
512 return LBITSET_HEAD (src
) != 0;
515 if (lbitset_equal_p (dst
, src
))
518 lbitset_copy (dst
, src
);
523 /* Return size in bits of bitset SRC. */
530 elt
= LBITSET_TAIL (src
);
534 /* Return current size of bitset in bits. */
535 return (elt
->index
+ LBITSET_ELT_WORDS
) * BITSET_WORD_BITS
;
539 /* Set bit BITNO in bitset DST. */
541 lbitset_set (dst
, bitno
)
545 bitset_windex index
= bitno
/ BITSET_WORD_BITS
;
547 lbitset_elt_find (dst
, index
, LBITSET_CREATE
);
549 dst
->cdata
[index
- dst
->cindex
] |= (1 << (bitno
% BITSET_WORD_BITS
));
553 /* Reset bit BITNO in bitset DST. */
555 lbitset_reset (dst
, bitno
)
559 bitset_windex index
= bitno
/ BITSET_WORD_BITS
;
561 if (!lbitset_elt_find (dst
, index
, LBITSET_FIND
))
564 dst
->cdata
[index
- dst
->cindex
] &= ~(1 << (bitno
% BITSET_WORD_BITS
));
566 /* If all the data is zero, perhaps we should unlink it now... */
570 /* Test bit BITNO in bitset SRC. */
572 lbitset_test (src
, bitno
)
576 bitset_windex index
= bitno
/ BITSET_WORD_BITS
;
578 if (!lbitset_elt_find (src
, index
, LBITSET_FIND
))
581 return (src
->cdata
[index
- src
->cindex
] >> (bitno
% BITSET_WORD_BITS
)) & 1;
593 /* Find list of up to NUM bits set in BSET starting from and including
594 *NEXT and store in array LIST. Return with actual number of bits
595 found and with *NEXT indicating where search stopped. */
597 lbitset_reverse_list (bset
, list
, num
, next
)
603 bitset_bindex rbitno
;
606 bitset_bindex bitoff
;
611 bitset_bindex n_bits
;
613 elt
= LBITSET_TAIL (bset
);
617 n_bits
= (elt
->index
+ LBITSET_ELT_WORDS
) * BITSET_WORD_BITS
;
620 if (rbitno
>= n_bits
)
623 bitno
= n_bits
- (rbitno
+ 1);
625 index
= bitno
/ BITSET_WORD_BITS
;
627 /* Skip back to starting element. */
628 for (; elt
&& elt
->index
> index
; elt
= elt
->prev
)
634 /* If num is 1, we could speed things up with a binary search
635 of the word of interest. */
638 bitcnt
= bitno
% BITSET_WORD_BITS
;
639 bitoff
= index
* BITSET_WORD_BITS
;
643 bitset_word
*srcp
= elt
->words
;
645 for (; (index
- elt
->index
) < LBITSET_ELT_WORDS
;
646 index
--, bitoff
-= BITSET_WORD_BITS
,
647 bitcnt
= BITSET_WORD_BITS
- 1)
649 word
= srcp
[index
- elt
->index
] << (BITSET_WORD_BITS
- 1 - bitcnt
);
651 for (; word
; bitcnt
--)
653 if (word
& BITSET_MSB
)
655 list
[count
++] = bitoff
+ bitcnt
;
658 *next
= n_bits
- (bitoff
+ bitcnt
);
669 index
= elt
->index
+ LBITSET_ELT_WORDS
- 1;
670 bitoff
= index
* BITSET_WORD_BITS
;
674 *next
= n_bits
- (bitoff
+ 1);
679 /* Find list of up to NUM bits set in BSET starting from and including
680 *NEXT and store in array LIST. Return with actual number of bits
681 found and with *NEXT indicating where search stopped. */
683 lbitset_list (bset
, list
, num
, next
)
696 head
= LBITSET_HEAD (bset
);
705 /* This is the most common case. */
707 /* Start with the first element. */
710 bitno
= index
* BITSET_WORD_BITS
;
714 index
= bitno
/ BITSET_WORD_BITS
;
716 /* Skip to starting element. */
718 elt
&& (elt
->index
+ LBITSET_ELT_WORDS
- 1) < index
;
725 if (index
< elt
->index
)
728 bitno
= index
* BITSET_WORD_BITS
;
732 bitset_word
*srcp
= elt
->words
;
734 /* We are starting within an element. */
736 for (; (index
- elt
->index
) < LBITSET_ELT_WORDS
; index
++)
738 word
= srcp
[index
- elt
->index
] >> (bitno
% BITSET_WORD_BITS
);
740 for (; word
; bitno
++)
744 list
[count
++] = bitno
;
753 bitno
= (index
+ 1) * BITSET_WORD_BITS
;
760 bitno
= index
* BITSET_WORD_BITS
;
766 /* If num is 1, we could speed things up with a binary search
767 of the word of interest. */
772 bitset_word
*srcp
= elt
->words
;
774 if ((count
+ LBITSET_ELT_BITS
) < num
)
776 /* The coast is clear, plant boot! */
778 #if LBITSET_ELT_WORDS == 2
782 if (! (word
& 0xffff))
792 for (; word
; bitno
++)
795 list
[count
++] = bitno
;
800 bitno
= index
* BITSET_WORD_BITS
;
805 if (! (word
& 0xffff))
810 for (; word
; bitno
++)
813 list
[count
++] = bitno
;
818 bitno
= index
* BITSET_WORD_BITS
;
820 for (i
= 0; i
< LBITSET_ELT_WORDS
; i
++)
825 if (! (word
& 0xffff))
835 for (; word
; bitno
++)
838 list
[count
++] = bitno
;
843 bitno
= index
* BITSET_WORD_BITS
;
849 /* Tread more carefully since we need to check
850 if array overflows. */
852 for (i
= 0; i
< LBITSET_ELT_WORDS
; i
++)
854 for (word
= srcp
[i
]; word
; bitno
++)
858 list
[count
++] = bitno
;
868 bitno
= index
* BITSET_WORD_BITS
;
876 bitno
= index
* BITSET_WORD_BITS
;
886 lbitset_op1 (dst
, op
)
901 /* This is a decidedly unfriendly operation for a linked list
903 elt
= LBITSET_TAIL (dst
);
904 /* Ignore empty set. */
909 for (i
= 0; i
< index
; i
+= LBITSET_ELT_WORDS
)
911 /* Create new elements if they cannot be found. */
912 elt
= lbitset_elt_find (dst
, i
, LBITSET_CREATE
);
913 memset (elt
->words
, ~0, sizeof (elt
->words
));
919 if (LBITSET_HEAD (dst
))
932 lbitset_op2 (dst
, src
, op
)
947 lbitset_copy (dst
, src
);
951 /* This is another unfriendly operation for a linked list
953 elt
= LBITSET_TAIL (dst
);
954 /* Ignore empty set. */
959 for (i
= 0; i
< index
; i
+= LBITSET_ELT_WORDS
)
961 /* Create new elements for dst if they cannot be found
962 or substitute zero elements if src elements not found. */
963 selt
= lbitset_elt_find (dst
, i
, LBITSET_SUBST
);
964 delt
= lbitset_elt_find (dst
, i
, LBITSET_CREATE
);
966 for (j
= 0; j
< LBITSET_ELT_WORDS
; j
++)
967 delt
->words
[j
] = ~selt
->words
[j
];
973 return lbitset_equal_p (dst
, src
);
976 case BITSET_SUBSET_P
:
977 for (selt
= LBITSET_HEAD (src
), delt
= LBITSET_HEAD (dst
);
978 selt
|| delt
; selt
= selt
->next
, delt
= delt
->next
)
981 selt
= &lbitset_zero_elts
[0];
983 delt
= &lbitset_zero_elts
[0];
984 else if (selt
->index
!= delt
->index
)
986 if (selt
->index
< delt
->index
)
988 lbitset_zero_elts
[2].next
= delt
;
989 delt
= &lbitset_zero_elts
[2];
993 lbitset_zero_elts
[1].next
= selt
;
994 selt
= &lbitset_zero_elts
[1];
998 for (j
= 0; j
< LBITSET_ELT_WORDS
; j
++)
999 if (delt
->words
[j
] != (selt
->words
[j
] | delt
->words
[j
]))
1013 lbitset_op3 (dst
, src1
, src2
, op
)
1019 lbitset_elt
*selt1
= LBITSET_HEAD (src1
);
1020 lbitset_elt
*selt2
= LBITSET_HEAD (src2
);
1021 lbitset_elt
*delt
= LBITSET_HEAD (dst
);
1022 bitset_windex index1
;
1023 bitset_windex index2
;
1024 bitset_windex index
;
1034 /* Fast track common, simple cases. */
1037 if (op
== BITSET_AND
)
1040 changed
= ! LBITSET_HEAD (dst
);
1044 else if (op
== BITSET_ANDN
|| op
== BITSET_OR
|| op
== BITSET_XOR
)
1046 return lbitset_copy_compare (dst
, src1
);
1051 if (op
== BITSET_AND
|| op
== BITSET_ANDN
)
1054 changed
= ! LBITSET_HEAD (dst
);
1058 else if (op
== BITSET_OR
|| op
== BITSET_XOR
)
1060 return lbitset_copy_compare (dst
, src2
);
1065 LBITSET_HEAD (dst
) = 0;
1068 index1
= (selt1
) ? selt1
->index
: BITSET_INDEX_MAX
;
1069 index2
= (selt2
) ? selt2
->index
: BITSET_INDEX_MAX
;
1071 while (selt1
|| selt2
)
1073 /* Figure out whether we need to substitute zero elements for
1075 if (index1
== index2
)
1080 selt1
= selt1
->next
;
1081 index1
= (selt1
) ? selt1
->index
: BITSET_INDEX_MAX
;
1082 selt2
= selt2
->next
;
1083 index2
= (selt2
) ? selt2
->index
: BITSET_INDEX_MAX
;
1085 else if (index1
< index2
)
1089 stmp2
= &lbitset_zero_elts
[0];
1090 selt1
= selt1
->next
;
1091 index1
= (selt1
) ? selt1
->index
: BITSET_INDEX_MAX
;
1096 stmp1
= &lbitset_zero_elts
[0];
1098 selt2
= selt2
->next
;
1099 index2
= (selt2
) ? selt2
->index
: BITSET_INDEX_MAX
;
1102 /* Find the appropriate element from DST. Begin by discarding
1103 elements that we've skipped. */
1104 while (delt
&& delt
->index
< index
)
1109 lbitset_elt_free (dtmp
);
1111 if (delt
&& delt
->index
== index
)
1117 dtmp
= lbitset_elt_calloc ();
1119 /* Do the operation, and if any bits are set, link it into the
1121 srcp1
= stmp1
->words
;
1122 srcp2
= stmp2
->words
;
1127 for (i
= 0; i
< LBITSET_ELT_WORDS
; i
++, dstp
++)
1129 bitset_word tmp
= *srcp1
++ | *srcp2
++;
1140 for (i
= 0; i
< LBITSET_ELT_WORDS
; i
++, dstp
++)
1142 bitset_word tmp
= *srcp1
++ & *srcp2
++;
1153 for (i
= 0; i
< LBITSET_ELT_WORDS
; i
++, dstp
++)
1155 bitset_word tmp
= *srcp1
++ ^ *srcp2
++;
1166 for (i
= 0; i
< LBITSET_ELT_WORDS
; i
++, dstp
++)
1168 bitset_word tmp
= *srcp1
++ & ~(*srcp2
++);
1179 for (i
= 0; i
< LBITSET_ELT_WORDS
; i
++, dstp
++)
1181 bitset_word tmp
= *srcp1
++ | ~(*srcp2
++);
1195 if (! lbitset_elt_zero_p (dtmp
))
1197 dtmp
->index
= index
;
1198 /* Perhaps this could be optimised... */
1199 lbitset_elt_link (dst
, dtmp
);
1203 lbitset_elt_free (dtmp
);
1207 /* If we have elements of DST left over, free them all. */
1211 lbitset_prune (dst
, delt
);
1219 lbitset_op4 (dst
, src1
, src2
, src3
, op
)
1229 #ifdef ENABLE_CHECKING
1230 /* Check for compatiblity. */
1231 if (src1
->ops
!= dst
->ops
|| src2
->ops
!= dst
->ops
|| src3
->ops
!= dst
->ops
)
1235 tmp
= bitset_create (BITSET_LIST
, 0);
1240 bitset_or (tmp
, src1
, src2
);
1241 changed
= bitset_and (dst
, src3
, tmp
);
1245 bitset_and (tmp
, src1
, src2
);
1246 changed
= bitset_or (dst
, src3
, tmp
);
1249 case BITSET_ANDN_OR
:
1250 bitset_andn (tmp
, src1
, src2
);
1251 changed
= bitset_or (dst
, src3
, tmp
);
1263 /* Vector of operations for linked-list bitsets. */
1264 struct bitset_ops_struct lbitset_ops
=
1275 lbitset_reverse_list
,
1281 /* Return size of initial structure. */
1283 lbitset_bytes (n_bits
)
1284 bitset_bindex n_bits ATTRIBUTE_UNUSED
;
1286 return sizeof (struct bitset_struct
);
1290 /* Initialize a bitset. */
1293 lbitset_init (bset
, n_bits
)
1295 bitset_bindex n_bits ATTRIBUTE_UNUSED
;
1297 LBITSET_HEAD (bset
) = 0;
1298 LBITSET_TAIL (bset
) = 0;
1300 bset
->ops
= &lbitset_ops
;
1303 /* Disable cache until have some elements allocated.
1304 If we have variable length arrays, then we may
1305 need to allocate dummy element. */
1313 lbitset_release_memory ()
1315 lbitset_free_list
= 0;
1316 if (lbitset_obstack_init
)
1318 lbitset_obstack_init
= 0;
1319 obstack_free (&lbitset_obstack
, NULL
);