1 /* Variable array bitsets.
3 Copyright (C) 2002-2006, 2009-2012 Free Software Foundation, Inc.
5 Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz).
7 This program is free software: you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation, either version 3 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>. */
27 /* This file implements variable size bitsets stored as a variable
28 length array of words. Any unused bits in the last word must be
31 Note that binary or ternary operations assume that each bitset operand
35 static void vbitset_unused_clear (bitset
);
37 static void vbitset_set (bitset
, bitset_bindex
);
38 static void vbitset_reset (bitset
, bitset_bindex
);
39 static bool vbitset_test (bitset
, bitset_bindex
);
40 static bitset_bindex
vbitset_list (bitset
, bitset_bindex
*,
41 bitset_bindex
, bitset_bindex
*);
42 static bitset_bindex
vbitset_list_reverse (bitset
, bitset_bindex
*,
43 bitset_bindex
, bitset_bindex
*);
45 #define VBITSET_N_WORDS(N) (((N) + BITSET_WORD_BITS - 1) / BITSET_WORD_BITS)
46 #define VBITSET_WORDS(X) ((X)->b.cdata)
47 #define VBITSET_SIZE(X) ((X)->b.csize)
48 #define VBITSET_ASIZE(X) ((X)->v.size)
52 #define min(a, b) ((a) > (b) ? (b) : (a))
53 #define max(a, b) ((a) > (b) ? (a) : (b))
56 vbitset_resize (bitset src
, bitset_bindex n_bits
)
58 bitset_windex oldsize
;
59 bitset_windex newsize
;
61 if (n_bits
== BITSET_NBITS_ (src
))
64 oldsize
= VBITSET_SIZE (src
);
65 newsize
= VBITSET_N_WORDS (n_bits
);
67 if (oldsize
< newsize
)
71 /* The bitset needs to grow. If we already have enough memory
72 allocated, then just zero what we need. */
73 if (newsize
> VBITSET_ASIZE (src
))
75 /* We need to allocate more memory. When oldsize is
76 non-zero this means that we are changing the size, so
77 grow the bitset 25% larger than requested to reduce
78 number of reallocations. */
83 size
= newsize
+ newsize
/ 4;
86 = realloc (VBITSET_WORDS (src
), size
* sizeof (bitset_word
));
87 VBITSET_ASIZE (src
) = size
;
90 memset (VBITSET_WORDS (src
) + oldsize
, 0,
91 (newsize
- oldsize
) * sizeof (bitset_word
));
92 VBITSET_SIZE (src
) = newsize
;
96 /* The bitset needs to shrink. There's no point deallocating
97 the memory unless it is shrinking by a reasonable amount. */
98 if ((oldsize
- newsize
) >= oldsize
/ 2)
101 = realloc (VBITSET_WORDS (src
), newsize
* sizeof (bitset_word
));
102 VBITSET_ASIZE (src
) = newsize
;
105 /* Need to prune any excess bits. FIXME. */
107 VBITSET_SIZE (src
) = newsize
;
110 BITSET_NBITS_ (src
) = n_bits
;
115 /* Set bit BITNO in bitset DST. */
117 vbitset_set (dst
, bitno
)
121 bitset_windex windex
= bitno
/ BITSET_WORD_BITS
;
123 /* Perhaps we should abort. The user should explicitly call
124 bitset_resize since this will not catch the case when we set a
125 bit larger than the current size but smaller than the allocated
127 vbitset_resize (dst
, bitno
);
129 dst
->b
.cdata
[windex
- dst
->b
.cindex
] |=
130 (bitset_word
) 1 << (bitno
% BITSET_WORD_BITS
);
134 /* Reset bit BITNO in bitset DST. */
136 vbitset_reset (dst
, bitno
)
137 bitset dst ATTRIBUTE_UNUSED
;
138 bitset_bindex bitno ATTRIBUTE_UNUSED
;
140 /* We must be accessing outside the cache so the bit is
145 /* Test bit BITNO in bitset SRC. */
147 vbitset_test (src
, bitno
)
148 bitset src ATTRIBUTE_UNUSED
;
149 bitset_bindex bitno ATTRIBUTE_UNUSED
;
151 /* We must be accessing outside the cache so the bit is
157 /* Find list of up to NUM bits set in BSET in reverse order, starting
158 from and including NEXT and store in array LIST. Return with
159 actual number of bits found and with *NEXT indicating where search
162 vbitset_list_reverse (src
, list
, num
, next
)
169 bitset_bindex rbitno
;
171 bitset_windex windex
;
173 bitset_bindex bitoff
;
174 bitset_word
*srcp
= VBITSET_WORDS (src
);
175 bitset_bindex n_bits
= BITSET_SIZE_ (src
);
179 /* If num is 1, we could speed things up with a binary search
180 of the word of interest. */
182 if (rbitno
>= n_bits
)
187 bitno
= n_bits
- (rbitno
+ 1);
189 windex
= bitno
/ BITSET_WORD_BITS
;
190 bitcnt
= bitno
% BITSET_WORD_BITS
;
191 bitoff
= windex
* BITSET_WORD_BITS
;
197 word
= srcp
[windex
] << (BITSET_WORD_BITS
- 1 - bitcnt
);
198 for (; word
; bitcnt
--)
200 if (word
& BITSET_MSB
)
202 list
[count
++] = bitoff
+ bitcnt
;
205 *next
= n_bits
- (bitoff
+ bitcnt
);
211 bitoff
-= BITSET_WORD_BITS
;
212 bitcnt
= BITSET_WORD_BITS
- 1;
216 *next
= n_bits
- (bitoff
+ 1);
221 /* Find list of up to NUM bits set in BSET starting from and including
222 *NEXT and store in array LIST. Return with actual number of bits
223 found and with *NEXT indicating where search stopped. */
225 vbitset_list (src
, list
, num
, next
)
233 bitset_windex windex
;
234 bitset_bindex bitoff
;
235 bitset_windex size
= VBITSET_SIZE (src
);
236 bitset_word
*srcp
= VBITSET_WORDS (src
);
244 /* Many bitsets are zero, so make this common case fast. */
245 for (windex
= 0; windex
< size
&& !srcp
[windex
]; windex
++)
250 /* If num is 1, we could speed things up with a binary search
251 of the current word. */
253 bitoff
= windex
* BITSET_WORD_BITS
;
257 if (bitno
>= BITSET_SIZE_ (src
))
260 windex
= bitno
/ BITSET_WORD_BITS
;
261 bitno
= bitno
% BITSET_WORD_BITS
;
265 /* Handle the case where we start within a word.
266 Most often, this is executed with large bitsets
267 with many set bits where we filled the array
268 on the previous call to this function. */
270 bitoff
= windex
* BITSET_WORD_BITS
;
271 word
= srcp
[windex
] >> bitno
;
272 for (bitno
= bitoff
+ bitno
; word
; bitno
++)
276 list
[count
++] = bitno
;
287 bitoff
= windex
* BITSET_WORD_BITS
;
290 for (; windex
< size
; windex
++, bitoff
+= BITSET_WORD_BITS
)
292 if (!(word
= srcp
[windex
]))
295 if ((count
+ BITSET_WORD_BITS
) < num
)
297 for (bitno
= bitoff
; word
; bitno
++)
300 list
[count
++] = bitno
;
306 for (bitno
= bitoff
; word
; bitno
++)
310 list
[count
++] = bitno
;
327 /* Ensure that any unused bits within the last word are clear. */
329 vbitset_unused_clear (dst
)
332 unsigned int last_bit
;
334 last_bit
= BITSET_SIZE_ (dst
) % BITSET_WORD_BITS
;
336 VBITSET_WORDS (dst
)[VBITSET_SIZE (dst
) - 1] &=
337 ((bitset_word
) 1 << last_bit
) - 1;
342 vbitset_ones (bitset dst
)
344 bitset_word
*dstp
= VBITSET_WORDS (dst
);
347 bytes
= sizeof (bitset_word
) * VBITSET_SIZE (dst
);
349 memset (dstp
, -1, bytes
);
350 vbitset_unused_clear (dst
);
355 vbitset_zero (bitset dst
)
357 bitset_word
*dstp
= VBITSET_WORDS (dst
);
360 bytes
= sizeof (bitset_word
) * VBITSET_SIZE (dst
);
362 memset (dstp
, 0, bytes
);
367 vbitset_empty_p (bitset dst
)
370 bitset_word
*dstp
= VBITSET_WORDS (dst
);
372 for (i
= 0; i
< VBITSET_SIZE (dst
); i
++)
381 vbitset_copy1 (bitset dst
, bitset src
)
391 vbitset_resize (dst
, BITSET_SIZE_ (src
));
393 srcp
= VBITSET_WORDS (src
);
394 dstp
= VBITSET_WORDS (dst
);
395 ssize
= VBITSET_SIZE (src
);
396 dsize
= VBITSET_SIZE (dst
);
398 memcpy (dstp
, srcp
, sizeof (bitset_word
) * ssize
);
400 memset (dstp
+ sizeof (bitset_word
) * ssize
, 0,
401 sizeof (bitset_word
) * (dsize
- ssize
));
406 vbitset_not (bitset dst
, bitset src
)
414 vbitset_resize (dst
, BITSET_SIZE_ (src
));
416 srcp
= VBITSET_WORDS (src
);
417 dstp
= VBITSET_WORDS (dst
);
418 ssize
= VBITSET_SIZE (src
);
419 dsize
= VBITSET_SIZE (dst
);
421 for (i
= 0; i
< ssize
; i
++)
422 *dstp
++ = ~(*srcp
++);
424 vbitset_unused_clear (dst
);
425 memset (dstp
+ sizeof (bitset_word
) * ssize
, 0,
426 sizeof (bitset_word
) * (dsize
- ssize
));
431 vbitset_equal_p (bitset dst
, bitset src
)
434 bitset_word
*srcp
= VBITSET_WORDS (src
);
435 bitset_word
*dstp
= VBITSET_WORDS (dst
);
436 bitset_windex ssize
= VBITSET_SIZE (src
);
437 bitset_windex dsize
= VBITSET_SIZE (dst
);
439 for (i
= 0; i
< min (ssize
, dsize
); i
++)
440 if (*srcp
++ != *dstp
++)
445 for (; i
< ssize
; i
++)
451 for (; i
< dsize
; i
++)
461 vbitset_subset_p (bitset dst
, bitset src
)
464 bitset_word
*srcp
= VBITSET_WORDS (src
);
465 bitset_word
*dstp
= VBITSET_WORDS (dst
);
466 bitset_windex ssize
= VBITSET_SIZE (src
);
467 bitset_windex dsize
= VBITSET_SIZE (dst
);
469 for (i
= 0; i
< min (ssize
, dsize
); i
++, dstp
++, srcp
++)
470 if (*dstp
!= (*srcp
| *dstp
))
475 for (; i
< ssize
; i
++)
485 vbitset_disjoint_p (bitset dst
, bitset src
)
488 bitset_word
*srcp
= VBITSET_WORDS (src
);
489 bitset_word
*dstp
= VBITSET_WORDS (dst
);
490 bitset_windex ssize
= VBITSET_SIZE (src
);
491 bitset_windex dsize
= VBITSET_SIZE (dst
);
493 for (i
= 0; i
< min (ssize
, dsize
); i
++)
494 if (*srcp
++ & *dstp
++)
502 vbitset_and (bitset dst
, bitset src1
, bitset src2
)
508 bitset_windex ssize1
;
509 bitset_windex ssize2
;
512 vbitset_resize (dst
, max (BITSET_SIZE_ (src1
), BITSET_SIZE_ (src2
)));
514 dsize
= VBITSET_SIZE (dst
);
515 ssize1
= VBITSET_SIZE (src1
);
516 ssize2
= VBITSET_SIZE (src2
);
517 dstp
= VBITSET_WORDS (dst
);
518 src1p
= VBITSET_WORDS (src1
);
519 src2p
= VBITSET_WORDS (src2
);
521 for (i
= 0; i
< min (ssize1
, ssize2
); i
++)
522 *dstp
++ = *src1p
++ & *src2p
++;
524 memset (dstp
, 0, sizeof (bitset_word
) * (dsize
- min (ssize1
, ssize2
)));
529 vbitset_and_cmp (bitset dst
, bitset src1
, bitset src2
)
536 bitset_windex ssize1
;
537 bitset_windex ssize2
;
540 vbitset_resize (dst
, max (BITSET_SIZE_ (src1
), BITSET_SIZE_ (src2
)));
542 dsize
= VBITSET_SIZE (dst
);
543 ssize1
= VBITSET_SIZE (src1
);
544 ssize2
= VBITSET_SIZE (src2
);
545 dstp
= VBITSET_WORDS (dst
);
546 src1p
= VBITSET_WORDS (src1
);
547 src2p
= VBITSET_WORDS (src2
);
549 for (i
= 0; i
< min (ssize1
, ssize2
); i
++, dstp
++)
551 bitset_word tmp
= *src1p
++ & *src2p
++;
566 for (; i
< ssize1
; i
++, dstp
++)
575 memset (dstp
, 0, sizeof (bitset_word
) * (dsize
- ssize1
));
582 vbitset_andn (bitset dst
, bitset src1
, bitset src2
)
588 bitset_windex ssize1
;
589 bitset_windex ssize2
;
592 vbitset_resize (dst
, max (BITSET_SIZE_ (src1
), BITSET_SIZE_ (src2
)));
594 dsize
= VBITSET_SIZE (dst
);
595 ssize1
= VBITSET_SIZE (src1
);
596 ssize2
= VBITSET_SIZE (src2
);
597 dstp
= VBITSET_WORDS (dst
);
598 src1p
= VBITSET_WORDS (src1
);
599 src2p
= VBITSET_WORDS (src2
);
601 for (i
= 0; i
< min (ssize1
, ssize2
); i
++)
602 *dstp
++ = *src1p
++ & ~(*src2p
++);
606 for (; i
< ssize2
; i
++)
609 memset (dstp
, 0, sizeof (bitset_word
) * (dsize
- ssize2
));
613 for (; i
< ssize1
; i
++)
616 memset (dstp
, 0, sizeof (bitset_word
) * (dsize
- ssize1
));
622 vbitset_andn_cmp (bitset dst
, bitset src1
, bitset src2
)
629 bitset_windex ssize1
;
630 bitset_windex ssize2
;
633 vbitset_resize (dst
, max (BITSET_SIZE_ (src1
), BITSET_SIZE_ (src2
)));
635 dsize
= VBITSET_SIZE (dst
);
636 ssize1
= VBITSET_SIZE (src1
);
637 ssize2
= VBITSET_SIZE (src2
);
638 dstp
= VBITSET_WORDS (dst
);
639 src1p
= VBITSET_WORDS (src1
);
640 src2p
= VBITSET_WORDS (src2
);
642 for (i
= 0; i
< min (ssize1
, ssize2
); i
++, dstp
++)
644 bitset_word tmp
= *src1p
++ & ~(*src2p
++);
655 for (; i
< ssize2
; i
++, dstp
++)
664 memset (dstp
, 0, sizeof (bitset_word
) * (dsize
- ssize2
));
668 for (; i
< ssize1
; i
++, dstp
++)
670 bitset_word tmp
= *src1p
++;
679 memset (dstp
, 0, sizeof (bitset_word
) * (dsize
- ssize1
));
687 vbitset_or (bitset dst
, bitset src1
, bitset src2
)
693 bitset_windex ssize1
;
694 bitset_windex ssize2
;
697 vbitset_resize (dst
, max (BITSET_SIZE_ (src1
), BITSET_SIZE_ (src2
)));
699 dsize
= VBITSET_SIZE (dst
);
700 ssize1
= VBITSET_SIZE (src1
);
701 ssize2
= VBITSET_SIZE (src2
);
702 dstp
= VBITSET_WORDS (dst
);
703 src1p
= VBITSET_WORDS (src1
);
704 src2p
= VBITSET_WORDS (src2
);
706 for (i
= 0; i
< min (ssize1
, ssize2
); i
++)
707 *dstp
++ = *src1p
++ | *src2p
++;
715 for (; i
< ssize1
; i
++)
718 memset (dstp
, 0, sizeof (bitset_word
) * (dsize
- ssize1
));
723 vbitset_or_cmp (bitset dst
, bitset src1
, bitset src2
)
730 bitset_windex ssize1
;
731 bitset_windex ssize2
;
734 vbitset_resize (dst
, max (BITSET_SIZE_ (src1
), BITSET_SIZE_ (src2
)));
736 dsize
= VBITSET_SIZE (dst
);
737 ssize1
= VBITSET_SIZE (src1
);
738 ssize2
= VBITSET_SIZE (src2
);
739 dstp
= VBITSET_WORDS (dst
);
740 src1p
= VBITSET_WORDS (src1
);
741 src2p
= VBITSET_WORDS (src2
);
743 for (i
= 0; i
< min (ssize1
, ssize2
); i
++, dstp
++)
745 bitset_word tmp
= *src1p
++ | *src2p
++;
760 for (; i
< ssize1
; i
++, dstp
++)
762 bitset_word tmp
= *src1p
++;
771 memset (dstp
, 0, sizeof (bitset_word
) * (dsize
- ssize1
));
778 vbitset_xor (bitset dst
, bitset src1
, bitset src2
)
784 bitset_windex ssize1
;
785 bitset_windex ssize2
;
788 vbitset_resize (dst
, max (BITSET_SIZE_ (src1
), BITSET_SIZE_ (src2
)));
790 dsize
= VBITSET_SIZE (dst
);
791 ssize1
= VBITSET_SIZE (src1
);
792 ssize2
= VBITSET_SIZE (src2
);
793 dstp
= VBITSET_WORDS (dst
);
794 src1p
= VBITSET_WORDS (src1
);
795 src2p
= VBITSET_WORDS (src2
);
797 for (i
= 0; i
< min (ssize1
, ssize2
); i
++)
798 *dstp
++ = *src1p
++ ^ *src2p
++;
806 for (; i
< ssize1
; i
++)
809 memset (dstp
, 0, sizeof (bitset_word
) * (dsize
- ssize1
));
814 vbitset_xor_cmp (bitset dst
, bitset src1
, bitset src2
)
821 bitset_windex ssize1
;
822 bitset_windex ssize2
;
825 vbitset_resize (dst
, max (BITSET_SIZE_ (src1
), BITSET_SIZE_ (src2
)));
827 dsize
= VBITSET_SIZE (dst
);
828 ssize1
= VBITSET_SIZE (src1
);
829 ssize2
= VBITSET_SIZE (src2
);
830 dstp
= VBITSET_WORDS (dst
);
831 src1p
= VBITSET_WORDS (src1
);
832 src2p
= VBITSET_WORDS (src2
);
834 for (i
= 0; i
< min (ssize1
, ssize2
); i
++, dstp
++)
836 bitset_word tmp
= *src1p
++ ^ *src2p
++;
851 for (; i
< ssize1
; i
++, dstp
++)
853 bitset_word tmp
= *src1p
++;
862 memset (dstp
, 0, sizeof (bitset_word
) * (dsize
- ssize1
));
868 /* FIXME, these operations need fixing for different size
872 vbitset_and_or (bitset dst
, bitset src1
, bitset src2
, bitset src3
)
881 if (BITSET_NBITS_ (src1
) != BITSET_NBITS_ (src2
)
882 || BITSET_NBITS_ (src1
) != BITSET_NBITS_ (src3
))
884 bitset_and_or_ (dst
, src1
, src2
, src3
);
888 vbitset_resize (dst
, BITSET_NBITS_ (src1
));
890 src1p
= VBITSET_WORDS (src1
);
891 src2p
= VBITSET_WORDS (src2
);
892 src3p
= VBITSET_WORDS (src3
);
893 dstp
= VBITSET_WORDS (dst
);
894 size
= VBITSET_SIZE (dst
);
896 for (i
= 0; i
< size
; i
++)
897 *dstp
++ = (*src1p
++ & *src2p
++) | *src3p
++;
902 vbitset_and_or_cmp (bitset dst
, bitset src1
, bitset src2
, bitset src3
)
912 if (BITSET_NBITS_ (src1
) != BITSET_NBITS_ (src2
)
913 || BITSET_NBITS_ (src1
) != BITSET_NBITS_ (src3
))
914 return bitset_and_or_cmp_ (dst
, src1
, src2
, src3
);
916 vbitset_resize (dst
, BITSET_NBITS_ (src1
));
918 src1p
= VBITSET_WORDS (src1
);
919 src2p
= VBITSET_WORDS (src2
);
920 src3p
= VBITSET_WORDS (src3
);
921 dstp
= VBITSET_WORDS (dst
);
922 size
= VBITSET_SIZE (dst
);
924 for (i
= 0; i
< size
; i
++, dstp
++)
926 bitset_word tmp
= (*src1p
++ & *src2p
++) | *src3p
++;
939 vbitset_andn_or (bitset dst
, bitset src1
, bitset src2
, bitset src3
)
948 if (BITSET_NBITS_ (src1
) != BITSET_NBITS_ (src2
)
949 || BITSET_NBITS_ (src1
) != BITSET_NBITS_ (src3
))
951 bitset_andn_or_ (dst
, src1
, src2
, src3
);
955 vbitset_resize (dst
, BITSET_NBITS_ (src1
));
957 src1p
= VBITSET_WORDS (src1
);
958 src2p
= VBITSET_WORDS (src2
);
959 src3p
= VBITSET_WORDS (src3
);
960 dstp
= VBITSET_WORDS (dst
);
961 size
= VBITSET_SIZE (dst
);
963 for (i
= 0; i
< size
; i
++)
964 *dstp
++ = (*src1p
++ & ~(*src2p
++)) | *src3p
++;
969 vbitset_andn_or_cmp (bitset dst
, bitset src1
, bitset src2
, bitset src3
)
979 if (BITSET_NBITS_ (src1
) != BITSET_NBITS_ (src2
)
980 || BITSET_NBITS_ (src1
) != BITSET_NBITS_ (src3
))
981 return bitset_andn_or_cmp_ (dst
, src1
, src2
, src3
);
983 vbitset_resize (dst
, BITSET_NBITS_ (src1
));
985 src1p
= VBITSET_WORDS (src1
);
986 src2p
= VBITSET_WORDS (src2
);
987 src3p
= VBITSET_WORDS (src3
);
988 dstp
= VBITSET_WORDS (dst
);
989 size
= VBITSET_SIZE (dst
);
991 for (i
= 0; i
< size
; i
++, dstp
++)
993 bitset_word tmp
= (*src1p
++ & ~(*src2p
++)) | *src3p
++;
1006 vbitset_or_and (bitset dst
, bitset src1
, bitset src2
, bitset src3
)
1015 if (BITSET_NBITS_ (src1
) != BITSET_NBITS_ (src2
)
1016 || BITSET_NBITS_ (src1
) != BITSET_NBITS_ (src3
))
1018 bitset_or_and_ (dst
, src1
, src2
, src3
);
1022 vbitset_resize (dst
, BITSET_NBITS_ (src1
));
1024 src1p
= VBITSET_WORDS (src1
);
1025 src2p
= VBITSET_WORDS (src2
);
1026 src3p
= VBITSET_WORDS (src3
);
1027 dstp
= VBITSET_WORDS (dst
);
1028 size
= VBITSET_SIZE (dst
);
1030 for (i
= 0; i
< size
; i
++)
1031 *dstp
++ = (*src1p
++ | *src2p
++) & *src3p
++;
1036 vbitset_or_and_cmp (bitset dst
, bitset src1
, bitset src2
, bitset src3
)
1046 if (BITSET_NBITS_ (src1
) != BITSET_NBITS_ (src2
)
1047 || BITSET_NBITS_ (src1
) != BITSET_NBITS_ (src3
))
1048 return bitset_or_and_cmp_ (dst
, src1
, src2
, src3
);
1050 vbitset_resize (dst
, BITSET_NBITS_ (src1
));
1052 src1p
= VBITSET_WORDS (src1
);
1053 src2p
= VBITSET_WORDS (src2
);
1054 src3p
= VBITSET_WORDS (src3
);
1055 dstp
= VBITSET_WORDS (dst
);
1056 size
= VBITSET_SIZE (dst
);
1058 for (i
= 0; i
< size
; i
++, dstp
++)
1060 bitset_word tmp
= (*src1p
++ | *src2p
++) & *src3p
++;
1073 vbitset_copy (bitset dst
, bitset src
)
1075 if (BITSET_COMPATIBLE_ (dst
, src
))
1076 vbitset_copy1 (dst
, src
);
1078 bitset_copy_ (dst
, src
);
1082 /* Vector of operations for multiple word bitsets. */
1083 struct bitset_vtable vbitset_vtable
= {
1110 vbitset_andn_or_cmp
,
1114 vbitset_list_reverse
,
1121 vbitset_bytes (n_bits
)
1122 bitset_bindex n_bits ATTRIBUTE_UNUSED
;
1124 return sizeof (struct vbitset_struct
);
1129 vbitset_init (bset
, n_bits
)
1131 bitset_bindex n_bits
;
1133 bset
->b
.vtable
= &vbitset_vtable
;
1137 VBITSET_SIZE (bset
) = 0;
1138 vbitset_resize (bset
, n_bits
);