1 /* Variable array bitsets.
2 Copyright (C) 2002, 2003 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 /* This file implements variable size bitsets stored as a variable
29 length array of words. Any unused bits in the last word must be
32 Note that binary or ternary operations assume that each bitset operand
36 static void vbitset_unused_clear
PARAMS ((bitset
));
38 static void vbitset_set
PARAMS ((bitset
, bitset_bindex
));
39 static void vbitset_reset
PARAMS ((bitset
, bitset_bindex
));
40 static bool vbitset_test
PARAMS ((bitset
, bitset_bindex
));
41 static bitset_bindex vbitset_list
PARAMS ((bitset
, bitset_bindex
*,
44 static bitset_bindex vbitset_list_reverse
PARAMS ((bitset
, bitset_bindex
*,
48 #define VBITSET_N_WORDS(N) (((N) + BITSET_WORD_BITS - 1) / BITSET_WORD_BITS)
49 #define VBITSET_WORDS(X) ((X)->b.cdata)
50 #define VBITSET_SIZE(X) ((X)->b.csize)
51 #define VBITSET_ASIZE(X) ((X)->v.size)
54 #define min(a, b) ((a) > (b) ? (b) : (a))
55 #define max(a, b) ((a) > (b) ? (a) : (b))
58 vbitset_resize (bitset src
, bitset_bindex n_bits
)
60 bitset_windex oldsize
;
61 bitset_windex newsize
;
63 if (n_bits
== BITSET_NBITS_ (src
))
66 oldsize
= VBITSET_SIZE (src
);
67 newsize
= VBITSET_N_WORDS (n_bits
);
69 if (oldsize
< newsize
)
73 /* The bitset needs to grow. If we already have enough memory
74 allocated, then just zero what we need. */
75 if (newsize
> VBITSET_ASIZE (src
))
77 /* We need to allocate more memory. When oldsize is
78 non-zero this means that we are changing the size, so
79 grow the bitset 25% larger than requested to reduce
80 number of reallocations. */
85 size
= newsize
+ newsize
/ 4;
88 = realloc (VBITSET_WORDS (src
), size
* sizeof (bitset_word
));
89 VBITSET_ASIZE (src
) = size
;
92 memset (VBITSET_WORDS (src
) + oldsize
, 0,
93 (newsize
- oldsize
) * sizeof (bitset_word
));
94 VBITSET_SIZE (src
) = newsize
;
98 /* The bitset needs to shrink. There's no point deallocating
99 the memory unless it is shrinking by a reasonable amount. */
100 if ((oldsize
- newsize
) >= oldsize
/ 2)
103 = realloc (VBITSET_WORDS (src
), newsize
* sizeof (bitset_word
));
104 VBITSET_ASIZE (src
) = newsize
;
107 /* Need to prune any excess bits. FIXME. */
109 VBITSET_SIZE (src
) = newsize
;
112 BITSET_NBITS_ (src
) = n_bits
;
117 /* Set bit BITNO in bitset DST. */
119 vbitset_set (dst
, bitno
)
123 bitset_windex windex
= bitno
/ BITSET_WORD_BITS
;
125 /* Perhaps we should abort. The user should explicitly call
126 bitset_resize since this will not catch the case when we set a
127 bit larger than the current size but smaller than the allocated
129 vbitset_resize (dst
, bitno
);
131 dst
->b
.cdata
[windex
- dst
->b
.cindex
] |=
132 (bitset_word
) 1 << (bitno
% BITSET_WORD_BITS
);
136 /* Reset bit BITNO in bitset DST. */
138 vbitset_reset (dst
, bitno
)
139 bitset dst ATTRIBUTE_UNUSED
;
140 bitset_bindex bitno ATTRIBUTE_UNUSED
;
142 /* We must be accessing outside the cache so the bit is
147 /* Test bit BITNO in bitset SRC. */
149 vbitset_test (src
, bitno
)
150 bitset src ATTRIBUTE_UNUSED
;
151 bitset_bindex bitno ATTRIBUTE_UNUSED
;
153 /* We must be accessing outside the cache so the bit is
159 /* Find list of up to NUM bits set in BSET in reverse order, starting
160 from and including NEXT and store in array LIST. Return with
161 actual number of bits found and with *NEXT indicating where search
164 vbitset_list_reverse (src
, list
, num
, next
)
171 bitset_bindex rbitno
;
173 bitset_windex windex
;
175 bitset_bindex bitoff
;
176 bitset_word
*srcp
= VBITSET_WORDS (src
);
177 bitset_bindex n_bits
= BITSET_SIZE_ (src
);
181 /* If num is 1, we could speed things up with a binary search
182 of the word of interest. */
184 if (rbitno
>= n_bits
)
189 bitno
= n_bits
- (rbitno
+ 1);
191 windex
= bitno
/ BITSET_WORD_BITS
;
192 bitcnt
= bitno
% BITSET_WORD_BITS
;
193 bitoff
= windex
* BITSET_WORD_BITS
;
199 word
= srcp
[windex
] << (BITSET_WORD_BITS
- 1 - bitcnt
);
200 for (; word
; bitcnt
--)
202 if (word
& BITSET_MSB
)
204 list
[count
++] = bitoff
+ bitcnt
;
207 *next
= n_bits
- (bitoff
+ bitcnt
);
213 bitoff
-= BITSET_WORD_BITS
;
214 bitcnt
= BITSET_WORD_BITS
- 1;
218 *next
= n_bits
- (bitoff
+ 1);
223 /* Find list of up to NUM bits set in BSET starting from and including
224 *NEXT and store in array LIST. Return with actual number of bits
225 found and with *NEXT indicating where search stopped. */
227 vbitset_list (src
, list
, num
, next
)
235 bitset_windex windex
;
236 bitset_bindex bitoff
;
237 bitset_windex size
= VBITSET_SIZE (src
);
238 bitset_word
*srcp
= VBITSET_WORDS (src
);
246 /* Many bitsets are zero, so make this common case fast. */
247 for (windex
= 0; windex
< size
&& !srcp
[windex
]; windex
++)
252 /* If num is 1, we could speed things up with a binary search
253 of the current word. */
255 bitoff
= windex
* BITSET_WORD_BITS
;
259 if (bitno
>= BITSET_SIZE_ (src
))
262 windex
= bitno
/ BITSET_WORD_BITS
;
263 bitno
= bitno
% BITSET_WORD_BITS
;
267 /* Handle the case where we start within a word.
268 Most often, this is executed with large bitsets
269 with many set bits where we filled the array
270 on the previous call to this function. */
272 bitoff
= windex
* BITSET_WORD_BITS
;
273 word
= srcp
[windex
] >> bitno
;
274 for (bitno
= bitoff
+ bitno
; word
; bitno
++)
278 list
[count
++] = bitno
;
289 bitoff
= windex
* BITSET_WORD_BITS
;
292 for (; windex
< size
; windex
++, bitoff
+= BITSET_WORD_BITS
)
294 if (!(word
= srcp
[windex
]))
297 if ((count
+ BITSET_WORD_BITS
) < num
)
299 for (bitno
= bitoff
; word
; bitno
++)
302 list
[count
++] = bitno
;
308 for (bitno
= bitoff
; word
; bitno
++)
312 list
[count
++] = bitno
;
329 /* Ensure that any unused bits within the last word are clear. */
331 vbitset_unused_clear (dst
)
334 unsigned int last_bit
;
336 last_bit
= BITSET_SIZE_ (dst
) % BITSET_WORD_BITS
;
338 VBITSET_WORDS (dst
)[VBITSET_SIZE (dst
) - 1] &=
339 ((bitset_word
) 1 << last_bit
) - 1;
344 vbitset_ones (bitset dst
)
346 bitset_word
*dstp
= VBITSET_WORDS (dst
);
349 bytes
= sizeof (bitset_word
) * VBITSET_SIZE (dst
);
351 memset (dstp
, -1, bytes
);
352 vbitset_unused_clear (dst
);
357 vbitset_zero (bitset dst
)
359 bitset_word
*dstp
= VBITSET_WORDS (dst
);
362 bytes
= sizeof (bitset_word
) * VBITSET_SIZE (dst
);
364 memset (dstp
, 0, bytes
);
369 vbitset_empty_p (bitset dst
)
372 bitset_word
*dstp
= VBITSET_WORDS (dst
);
374 for (i
= 0; i
< VBITSET_SIZE (dst
); i
++)
383 vbitset_copy1 (bitset dst
, bitset src
)
393 vbitset_resize (dst
, BITSET_SIZE_ (src
));
395 srcp
= VBITSET_WORDS (src
);
396 dstp
= VBITSET_WORDS (dst
);
397 ssize
= VBITSET_SIZE (src
);
398 dsize
= VBITSET_SIZE (dst
);
400 memcpy (dstp
, srcp
, sizeof (bitset_word
) * ssize
);
402 memset (dstp
+ sizeof (bitset_word
) * ssize
, 0,
403 sizeof (bitset_word
) * (dsize
- ssize
));
408 vbitset_not (bitset dst
, bitset src
)
416 vbitset_resize (dst
, BITSET_SIZE_ (src
));
418 srcp
= VBITSET_WORDS (src
);
419 dstp
= VBITSET_WORDS (dst
);
420 ssize
= VBITSET_SIZE (src
);
421 dsize
= VBITSET_SIZE (dst
);
423 for (i
= 0; i
< ssize
; i
++)
424 *dstp
++ = ~(*srcp
++);
426 vbitset_unused_clear (dst
);
427 memset (dstp
+ sizeof (bitset_word
) * ssize
, 0,
428 sizeof (bitset_word
) * (dsize
- ssize
));
433 vbitset_equal_p (bitset dst
, bitset src
)
436 bitset_word
*srcp
= VBITSET_WORDS (src
);
437 bitset_word
*dstp
= VBITSET_WORDS (dst
);
438 bitset_windex ssize
= VBITSET_SIZE (src
);
439 bitset_windex dsize
= VBITSET_SIZE (dst
);
441 for (i
= 0; i
< min (ssize
, dsize
); i
++)
442 if (*srcp
++ != *dstp
++)
447 for (; i
< ssize
; i
++)
453 for (; i
< dsize
; i
++)
463 vbitset_subset_p (bitset dst
, bitset src
)
466 bitset_word
*srcp
= VBITSET_WORDS (src
);
467 bitset_word
*dstp
= VBITSET_WORDS (dst
);
468 bitset_windex ssize
= VBITSET_SIZE (src
);
469 bitset_windex dsize
= VBITSET_SIZE (dst
);
471 for (i
= 0; i
< min (ssize
, dsize
); i
++, dstp
++, srcp
++)
472 if (*dstp
!= (*srcp
| *dstp
))
477 for (; i
< ssize
; i
++)
487 vbitset_disjoint_p (bitset dst
, bitset src
)
490 bitset_word
*srcp
= VBITSET_WORDS (src
);
491 bitset_word
*dstp
= VBITSET_WORDS (dst
);
492 bitset_windex ssize
= VBITSET_SIZE (src
);
493 bitset_windex dsize
= VBITSET_SIZE (dst
);
495 for (i
= 0; i
< min (ssize
, dsize
); i
++)
496 if (*srcp
++ & *dstp
++)
504 vbitset_and (bitset dst
, bitset src1
, bitset src2
)
510 bitset_windex ssize1
;
511 bitset_windex ssize2
;
514 vbitset_resize (dst
, max (BITSET_SIZE_ (src1
), BITSET_SIZE_ (src2
)));
516 dsize
= VBITSET_SIZE (dst
);
517 ssize1
= VBITSET_SIZE (src1
);
518 ssize2
= VBITSET_SIZE (src2
);
519 dstp
= VBITSET_WORDS (dst
);
520 src1p
= VBITSET_WORDS (src1
);
521 src2p
= VBITSET_WORDS (src2
);
523 for (i
= 0; i
< min (ssize1
, ssize2
); i
++)
524 *dstp
++ = *src1p
++ & *src2p
++;
526 memset (dstp
, 0, sizeof (bitset_word
) * (dsize
- min (ssize1
, ssize2
)));
531 vbitset_and_cmp (bitset dst
, bitset src1
, bitset src2
)
538 bitset_windex ssize1
;
539 bitset_windex ssize2
;
542 vbitset_resize (dst
, max (BITSET_SIZE_ (src1
), BITSET_SIZE_ (src2
)));
544 dsize
= VBITSET_SIZE (dst
);
545 ssize1
= VBITSET_SIZE (src1
);
546 ssize2
= VBITSET_SIZE (src2
);
547 dstp
= VBITSET_WORDS (dst
);
548 src1p
= VBITSET_WORDS (src1
);
549 src2p
= VBITSET_WORDS (src2
);
551 for (i
= 0; i
< min (ssize1
, ssize2
); i
++, dstp
++)
553 bitset_word tmp
= *src1p
++ & *src2p
++;
568 for (; i
< ssize1
; i
++, dstp
++)
577 memset (dstp
, 0, sizeof (bitset_word
) * (dsize
- ssize1
));
584 vbitset_andn (bitset dst
, bitset src1
, bitset src2
)
590 bitset_windex ssize1
;
591 bitset_windex ssize2
;
594 vbitset_resize (dst
, max (BITSET_SIZE_ (src1
), BITSET_SIZE_ (src2
)));
596 dsize
= VBITSET_SIZE (dst
);
597 ssize1
= VBITSET_SIZE (src1
);
598 ssize2
= VBITSET_SIZE (src2
);
599 dstp
= VBITSET_WORDS (dst
);
600 src1p
= VBITSET_WORDS (src1
);
601 src2p
= VBITSET_WORDS (src2
);
603 for (i
= 0; i
< min (ssize1
, ssize2
); i
++)
604 *dstp
++ = *src1p
++ & ~(*src2p
++);
608 for (; i
< ssize2
; i
++)
611 memset (dstp
, 0, sizeof (bitset_word
) * (dsize
- ssize2
));
615 for (; i
< ssize1
; i
++)
618 memset (dstp
, 0, sizeof (bitset_word
) * (dsize
- ssize1
));
624 vbitset_andn_cmp (bitset dst
, bitset src1
, bitset src2
)
631 bitset_windex ssize1
;
632 bitset_windex ssize2
;
635 vbitset_resize (dst
, max (BITSET_SIZE_ (src1
), BITSET_SIZE_ (src2
)));
637 dsize
= VBITSET_SIZE (dst
);
638 ssize1
= VBITSET_SIZE (src1
);
639 ssize2
= VBITSET_SIZE (src2
);
640 dstp
= VBITSET_WORDS (dst
);
641 src1p
= VBITSET_WORDS (src1
);
642 src2p
= VBITSET_WORDS (src2
);
644 for (i
= 0; i
< min (ssize1
, ssize2
); i
++, dstp
++)
646 bitset_word tmp
= *src1p
++ & ~(*src2p
++);
657 for (; i
< ssize2
; i
++, dstp
++)
666 memset (dstp
, 0, sizeof (bitset_word
) * (dsize
- ssize2
));
670 for (; i
< ssize1
; i
++, dstp
++)
672 bitset_word tmp
= *src1p
++;
681 memset (dstp
, 0, sizeof (bitset_word
) * (dsize
- ssize1
));
689 vbitset_or (bitset dst
, bitset src1
, bitset src2
)
695 bitset_windex ssize1
;
696 bitset_windex ssize2
;
699 vbitset_resize (dst
, max (BITSET_SIZE_ (src1
), BITSET_SIZE_ (src2
)));
701 dsize
= VBITSET_SIZE (dst
);
702 ssize1
= VBITSET_SIZE (src1
);
703 ssize2
= VBITSET_SIZE (src2
);
704 dstp
= VBITSET_WORDS (dst
);
705 src1p
= VBITSET_WORDS (src1
);
706 src2p
= VBITSET_WORDS (src2
);
708 for (i
= 0; i
< min (ssize1
, ssize2
); i
++)
709 *dstp
++ = *src1p
++ | *src2p
++;
717 for (; i
< ssize1
; i
++)
720 memset (dstp
, 0, sizeof (bitset_word
) * (dsize
- ssize1
));
725 vbitset_or_cmp (bitset dst
, bitset src1
, bitset src2
)
732 bitset_windex ssize1
;
733 bitset_windex ssize2
;
736 vbitset_resize (dst
, max (BITSET_SIZE_ (src1
), BITSET_SIZE_ (src2
)));
738 dsize
= VBITSET_SIZE (dst
);
739 ssize1
= VBITSET_SIZE (src1
);
740 ssize2
= VBITSET_SIZE (src2
);
741 dstp
= VBITSET_WORDS (dst
);
742 src1p
= VBITSET_WORDS (src1
);
743 src2p
= VBITSET_WORDS (src2
);
745 for (i
= 0; i
< min (ssize1
, ssize2
); i
++, dstp
++)
747 bitset_word tmp
= *src1p
++ | *src2p
++;
762 for (; i
< ssize1
; i
++, dstp
++)
764 bitset_word tmp
= *src1p
++;
773 memset (dstp
, 0, sizeof (bitset_word
) * (dsize
- ssize1
));
780 vbitset_xor (bitset dst
, bitset src1
, bitset src2
)
786 bitset_windex ssize1
;
787 bitset_windex ssize2
;
790 vbitset_resize (dst
, max (BITSET_SIZE_ (src1
), BITSET_SIZE_ (src2
)));
792 dsize
= VBITSET_SIZE (dst
);
793 ssize1
= VBITSET_SIZE (src1
);
794 ssize2
= VBITSET_SIZE (src2
);
795 dstp
= VBITSET_WORDS (dst
);
796 src1p
= VBITSET_WORDS (src1
);
797 src2p
= VBITSET_WORDS (src2
);
799 for (i
= 0; i
< min (ssize1
, ssize2
); i
++)
800 *dstp
++ = *src1p
++ ^ *src2p
++;
808 for (; i
< ssize1
; i
++)
811 memset (dstp
, 0, sizeof (bitset_word
) * (dsize
- ssize1
));
816 vbitset_xor_cmp (bitset dst
, bitset src1
, bitset src2
)
823 bitset_windex ssize1
;
824 bitset_windex ssize2
;
827 vbitset_resize (dst
, max (BITSET_SIZE_ (src1
), BITSET_SIZE_ (src2
)));
829 dsize
= VBITSET_SIZE (dst
);
830 ssize1
= VBITSET_SIZE (src1
);
831 ssize2
= VBITSET_SIZE (src2
);
832 dstp
= VBITSET_WORDS (dst
);
833 src1p
= VBITSET_WORDS (src1
);
834 src2p
= VBITSET_WORDS (src2
);
836 for (i
= 0; i
< min (ssize1
, ssize2
); i
++, dstp
++)
838 bitset_word tmp
= *src1p
++ ^ *src2p
++;
853 for (; i
< ssize1
; i
++, dstp
++)
855 bitset_word tmp
= *src1p
++;
864 memset (dstp
, 0, sizeof (bitset_word
) * (dsize
- ssize1
));
870 /* FIXME, these operations need fixing for different size
874 vbitset_and_or (bitset dst
, bitset src1
, bitset src2
, bitset src3
)
883 if (BITSET_NBITS_ (src1
) != BITSET_NBITS_ (src2
)
884 || BITSET_NBITS_ (src1
) != BITSET_NBITS_ (src3
))
886 bitset_and_or_ (dst
, src1
, src2
, src3
);
890 vbitset_resize (dst
, BITSET_NBITS_ (src1
));
892 src1p
= VBITSET_WORDS (src1
);
893 src2p
= VBITSET_WORDS (src2
);
894 src3p
= VBITSET_WORDS (src3
);
895 dstp
= VBITSET_WORDS (dst
);
896 size
= VBITSET_SIZE (dst
);
898 for (i
= 0; i
< size
; i
++)
899 *dstp
++ = (*src1p
++ & *src2p
++) | *src3p
++;
904 vbitset_and_or_cmp (bitset dst
, bitset src1
, bitset src2
, bitset src3
)
914 if (BITSET_NBITS_ (src1
) != BITSET_NBITS_ (src2
)
915 || BITSET_NBITS_ (src1
) != BITSET_NBITS_ (src3
))
916 return bitset_and_or_cmp_ (dst
, src1
, src2
, src3
);
918 vbitset_resize (dst
, BITSET_NBITS_ (src1
));
920 src1p
= VBITSET_WORDS (src1
);
921 src2p
= VBITSET_WORDS (src2
);
922 src3p
= VBITSET_WORDS (src3
);
923 dstp
= VBITSET_WORDS (dst
);
924 size
= VBITSET_SIZE (dst
);
926 for (i
= 0; i
< size
; i
++, dstp
++)
928 bitset_word tmp
= (*src1p
++ & *src2p
++) | *src3p
++;
941 vbitset_andn_or (bitset dst
, bitset src1
, bitset src2
, bitset src3
)
950 if (BITSET_NBITS_ (src1
) != BITSET_NBITS_ (src2
)
951 || BITSET_NBITS_ (src1
) != BITSET_NBITS_ (src3
))
953 bitset_andn_or_ (dst
, src1
, src2
, src3
);
957 vbitset_resize (dst
, BITSET_NBITS_ (src1
));
959 src1p
= VBITSET_WORDS (src1
);
960 src2p
= VBITSET_WORDS (src2
);
961 src3p
= VBITSET_WORDS (src3
);
962 dstp
= VBITSET_WORDS (dst
);
963 size
= VBITSET_SIZE (dst
);
965 for (i
= 0; i
< size
; i
++)
966 *dstp
++ = (*src1p
++ & ~(*src2p
++)) | *src3p
++;
971 vbitset_andn_or_cmp (bitset dst
, bitset src1
, bitset src2
, bitset src3
)
981 if (BITSET_NBITS_ (src1
) != BITSET_NBITS_ (src2
)
982 || BITSET_NBITS_ (src1
) != BITSET_NBITS_ (src3
))
983 return bitset_andn_or_cmp_ (dst
, src1
, src2
, src3
);
985 vbitset_resize (dst
, BITSET_NBITS_ (src1
));
987 src1p
= VBITSET_WORDS (src1
);
988 src2p
= VBITSET_WORDS (src2
);
989 src3p
= VBITSET_WORDS (src3
);
990 dstp
= VBITSET_WORDS (dst
);
991 size
= VBITSET_SIZE (dst
);
993 for (i
= 0; i
< size
; i
++, dstp
++)
995 bitset_word tmp
= (*src1p
++ & ~(*src2p
++)) | *src3p
++;
1008 vbitset_or_and (bitset dst
, bitset src1
, bitset src2
, bitset src3
)
1017 if (BITSET_NBITS_ (src1
) != BITSET_NBITS_ (src2
)
1018 || BITSET_NBITS_ (src1
) != BITSET_NBITS_ (src3
))
1020 bitset_or_and_ (dst
, src1
, src2
, src3
);
1024 vbitset_resize (dst
, BITSET_NBITS_ (src1
));
1026 src1p
= VBITSET_WORDS (src1
);
1027 src2p
= VBITSET_WORDS (src2
);
1028 src3p
= VBITSET_WORDS (src3
);
1029 dstp
= VBITSET_WORDS (dst
);
1030 size
= VBITSET_SIZE (dst
);
1032 for (i
= 0; i
< size
; i
++)
1033 *dstp
++ = (*src1p
++ | *src2p
++) & *src3p
++;
1038 vbitset_or_and_cmp (bitset dst
, bitset src1
, bitset src2
, bitset src3
)
1048 if (BITSET_NBITS_ (src1
) != BITSET_NBITS_ (src2
)
1049 || BITSET_NBITS_ (src1
) != BITSET_NBITS_ (src3
))
1050 return bitset_or_and_cmp_ (dst
, src1
, src2
, src3
);
1052 vbitset_resize (dst
, BITSET_NBITS_ (src1
));
1054 src1p
= VBITSET_WORDS (src1
);
1055 src2p
= VBITSET_WORDS (src2
);
1056 src3p
= VBITSET_WORDS (src3
);
1057 dstp
= VBITSET_WORDS (dst
);
1058 size
= VBITSET_SIZE (dst
);
1060 for (i
= 0; i
< size
; i
++, dstp
++)
1062 bitset_word tmp
= (*src1p
++ | *src2p
++) & *src3p
++;
1075 vbitset_copy (bitset dst
, bitset src
)
1077 if (BITSET_COMPATIBLE_ (dst
, src
))
1078 vbitset_copy1 (dst
, src
);
1080 bitset_copy_ (dst
, src
);
1084 /* Vector of operations for multiple word bitsets. */
1085 struct bitset_vtable vbitset_vtable
= {
1112 vbitset_andn_or_cmp
,
1116 vbitset_list_reverse
,
1123 vbitset_bytes (n_bits
)
1124 bitset_bindex n_bits ATTRIBUTE_UNUSED
;
1126 return sizeof (struct vbitset_struct
);
1131 vbitset_init (bset
, n_bits
)
1133 bitset_bindex n_bits
;
1135 bset
->b
.vtable
= &vbitset_vtable
;
1139 VBITSET_SIZE (bset
) = 0;
1140 vbitset_resize (bset
, n_bits
);