1 /* Variable array bitsets.
2 Copyright (C) 2002-2006, 2009-2010 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 3 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, see <http://www.gnu.org/licenses/>. */
25 /* This file implements variable size bitsets stored as a variable
26 length array of words. Any unused bits in the last word must be
29 Note that binary or ternary operations assume that each bitset operand
33 static void vbitset_unused_clear (bitset
);
35 static void vbitset_set (bitset
, bitset_bindex
);
36 static void vbitset_reset (bitset
, bitset_bindex
);
37 static bool vbitset_test (bitset
, bitset_bindex
);
38 static bitset_bindex
vbitset_list (bitset
, bitset_bindex
*,
39 bitset_bindex
, bitset_bindex
*);
40 static bitset_bindex
vbitset_list_reverse (bitset
, bitset_bindex
*,
41 bitset_bindex
, bitset_bindex
*);
43 #define VBITSET_N_WORDS(N) (((N) + BITSET_WORD_BITS - 1) / BITSET_WORD_BITS)
44 #define VBITSET_WORDS(X) ((X)->b.cdata)
45 #define VBITSET_SIZE(X) ((X)->b.csize)
46 #define VBITSET_ASIZE(X) ((X)->v.size)
50 #define min(a, b) ((a) > (b) ? (b) : (a))
51 #define max(a, b) ((a) > (b) ? (a) : (b))
54 vbitset_resize (bitset src
, bitset_bindex n_bits
)
56 bitset_windex oldsize
;
57 bitset_windex newsize
;
59 if (n_bits
== BITSET_NBITS_ (src
))
62 oldsize
= VBITSET_SIZE (src
);
63 newsize
= VBITSET_N_WORDS (n_bits
);
65 if (oldsize
< newsize
)
69 /* The bitset needs to grow. If we already have enough memory
70 allocated, then just zero what we need. */
71 if (newsize
> VBITSET_ASIZE (src
))
73 /* We need to allocate more memory. When oldsize is
74 non-zero this means that we are changing the size, so
75 grow the bitset 25% larger than requested to reduce
76 number of reallocations. */
81 size
= newsize
+ newsize
/ 4;
84 = realloc (VBITSET_WORDS (src
), size
* sizeof (bitset_word
));
85 VBITSET_ASIZE (src
) = size
;
88 memset (VBITSET_WORDS (src
) + oldsize
, 0,
89 (newsize
- oldsize
) * sizeof (bitset_word
));
90 VBITSET_SIZE (src
) = newsize
;
94 /* The bitset needs to shrink. There's no point deallocating
95 the memory unless it is shrinking by a reasonable amount. */
96 if ((oldsize
- newsize
) >= oldsize
/ 2)
99 = realloc (VBITSET_WORDS (src
), newsize
* sizeof (bitset_word
));
100 VBITSET_ASIZE (src
) = newsize
;
103 /* Need to prune any excess bits. FIXME. */
105 VBITSET_SIZE (src
) = newsize
;
108 BITSET_NBITS_ (src
) = n_bits
;
113 /* Set bit BITNO in bitset DST. */
115 vbitset_set (dst
, bitno
)
119 bitset_windex windex
= bitno
/ BITSET_WORD_BITS
;
121 /* Perhaps we should abort. The user should explicitly call
122 bitset_resize since this will not catch the case when we set a
123 bit larger than the current size but smaller than the allocated
125 vbitset_resize (dst
, bitno
);
127 dst
->b
.cdata
[windex
- dst
->b
.cindex
] |=
128 (bitset_word
) 1 << (bitno
% BITSET_WORD_BITS
);
132 /* Reset bit BITNO in bitset DST. */
134 vbitset_reset (dst
, bitno
)
135 bitset dst ATTRIBUTE_UNUSED
;
136 bitset_bindex bitno ATTRIBUTE_UNUSED
;
138 /* We must be accessing outside the cache so the bit is
143 /* Test bit BITNO in bitset SRC. */
145 vbitset_test (src
, bitno
)
146 bitset src ATTRIBUTE_UNUSED
;
147 bitset_bindex bitno ATTRIBUTE_UNUSED
;
149 /* We must be accessing outside the cache so the bit is
155 /* Find list of up to NUM bits set in BSET in reverse order, starting
156 from and including NEXT and store in array LIST. Return with
157 actual number of bits found and with *NEXT indicating where search
160 vbitset_list_reverse (src
, list
, num
, next
)
167 bitset_bindex rbitno
;
169 bitset_windex windex
;
171 bitset_bindex bitoff
;
172 bitset_word
*srcp
= VBITSET_WORDS (src
);
173 bitset_bindex n_bits
= BITSET_SIZE_ (src
);
177 /* If num is 1, we could speed things up with a binary search
178 of the word of interest. */
180 if (rbitno
>= n_bits
)
185 bitno
= n_bits
- (rbitno
+ 1);
187 windex
= bitno
/ BITSET_WORD_BITS
;
188 bitcnt
= bitno
% BITSET_WORD_BITS
;
189 bitoff
= windex
* BITSET_WORD_BITS
;
195 word
= srcp
[windex
] << (BITSET_WORD_BITS
- 1 - bitcnt
);
196 for (; word
; bitcnt
--)
198 if (word
& BITSET_MSB
)
200 list
[count
++] = bitoff
+ bitcnt
;
203 *next
= n_bits
- (bitoff
+ bitcnt
);
209 bitoff
-= BITSET_WORD_BITS
;
210 bitcnt
= BITSET_WORD_BITS
- 1;
214 *next
= n_bits
- (bitoff
+ 1);
219 /* Find list of up to NUM bits set in BSET starting from and including
220 *NEXT and store in array LIST. Return with actual number of bits
221 found and with *NEXT indicating where search stopped. */
223 vbitset_list (src
, list
, num
, next
)
231 bitset_windex windex
;
232 bitset_bindex bitoff
;
233 bitset_windex size
= VBITSET_SIZE (src
);
234 bitset_word
*srcp
= VBITSET_WORDS (src
);
242 /* Many bitsets are zero, so make this common case fast. */
243 for (windex
= 0; windex
< size
&& !srcp
[windex
]; windex
++)
248 /* If num is 1, we could speed things up with a binary search
249 of the current word. */
251 bitoff
= windex
* BITSET_WORD_BITS
;
255 if (bitno
>= BITSET_SIZE_ (src
))
258 windex
= bitno
/ BITSET_WORD_BITS
;
259 bitno
= bitno
% BITSET_WORD_BITS
;
263 /* Handle the case where we start within a word.
264 Most often, this is executed with large bitsets
265 with many set bits where we filled the array
266 on the previous call to this function. */
268 bitoff
= windex
* BITSET_WORD_BITS
;
269 word
= srcp
[windex
] >> bitno
;
270 for (bitno
= bitoff
+ bitno
; word
; bitno
++)
274 list
[count
++] = bitno
;
285 bitoff
= windex
* BITSET_WORD_BITS
;
288 for (; windex
< size
; windex
++, bitoff
+= BITSET_WORD_BITS
)
290 if (!(word
= srcp
[windex
]))
293 if ((count
+ BITSET_WORD_BITS
) < num
)
295 for (bitno
= bitoff
; word
; bitno
++)
298 list
[count
++] = bitno
;
304 for (bitno
= bitoff
; word
; bitno
++)
308 list
[count
++] = bitno
;
325 /* Ensure that any unused bits within the last word are clear. */
327 vbitset_unused_clear (dst
)
330 unsigned int last_bit
;
332 last_bit
= BITSET_SIZE_ (dst
) % BITSET_WORD_BITS
;
334 VBITSET_WORDS (dst
)[VBITSET_SIZE (dst
) - 1] &=
335 ((bitset_word
) 1 << last_bit
) - 1;
340 vbitset_ones (bitset dst
)
342 bitset_word
*dstp
= VBITSET_WORDS (dst
);
345 bytes
= sizeof (bitset_word
) * VBITSET_SIZE (dst
);
347 memset (dstp
, -1, bytes
);
348 vbitset_unused_clear (dst
);
353 vbitset_zero (bitset dst
)
355 bitset_word
*dstp
= VBITSET_WORDS (dst
);
358 bytes
= sizeof (bitset_word
) * VBITSET_SIZE (dst
);
360 memset (dstp
, 0, bytes
);
365 vbitset_empty_p (bitset dst
)
368 bitset_word
*dstp
= VBITSET_WORDS (dst
);
370 for (i
= 0; i
< VBITSET_SIZE (dst
); i
++)
379 vbitset_copy1 (bitset dst
, bitset src
)
389 vbitset_resize (dst
, BITSET_SIZE_ (src
));
391 srcp
= VBITSET_WORDS (src
);
392 dstp
= VBITSET_WORDS (dst
);
393 ssize
= VBITSET_SIZE (src
);
394 dsize
= VBITSET_SIZE (dst
);
396 memcpy (dstp
, srcp
, sizeof (bitset_word
) * ssize
);
398 memset (dstp
+ sizeof (bitset_word
) * ssize
, 0,
399 sizeof (bitset_word
) * (dsize
- ssize
));
404 vbitset_not (bitset dst
, bitset src
)
412 vbitset_resize (dst
, BITSET_SIZE_ (src
));
414 srcp
= VBITSET_WORDS (src
);
415 dstp
= VBITSET_WORDS (dst
);
416 ssize
= VBITSET_SIZE (src
);
417 dsize
= VBITSET_SIZE (dst
);
419 for (i
= 0; i
< ssize
; i
++)
420 *dstp
++ = ~(*srcp
++);
422 vbitset_unused_clear (dst
);
423 memset (dstp
+ sizeof (bitset_word
) * ssize
, 0,
424 sizeof (bitset_word
) * (dsize
- ssize
));
429 vbitset_equal_p (bitset dst
, bitset src
)
432 bitset_word
*srcp
= VBITSET_WORDS (src
);
433 bitset_word
*dstp
= VBITSET_WORDS (dst
);
434 bitset_windex ssize
= VBITSET_SIZE (src
);
435 bitset_windex dsize
= VBITSET_SIZE (dst
);
437 for (i
= 0; i
< min (ssize
, dsize
); i
++)
438 if (*srcp
++ != *dstp
++)
443 for (; i
< ssize
; i
++)
449 for (; i
< dsize
; i
++)
459 vbitset_subset_p (bitset dst
, bitset src
)
462 bitset_word
*srcp
= VBITSET_WORDS (src
);
463 bitset_word
*dstp
= VBITSET_WORDS (dst
);
464 bitset_windex ssize
= VBITSET_SIZE (src
);
465 bitset_windex dsize
= VBITSET_SIZE (dst
);
467 for (i
= 0; i
< min (ssize
, dsize
); i
++, dstp
++, srcp
++)
468 if (*dstp
!= (*srcp
| *dstp
))
473 for (; i
< ssize
; i
++)
483 vbitset_disjoint_p (bitset dst
, bitset src
)
486 bitset_word
*srcp
= VBITSET_WORDS (src
);
487 bitset_word
*dstp
= VBITSET_WORDS (dst
);
488 bitset_windex ssize
= VBITSET_SIZE (src
);
489 bitset_windex dsize
= VBITSET_SIZE (dst
);
491 for (i
= 0; i
< min (ssize
, dsize
); i
++)
492 if (*srcp
++ & *dstp
++)
500 vbitset_and (bitset dst
, bitset src1
, bitset src2
)
506 bitset_windex ssize1
;
507 bitset_windex ssize2
;
510 vbitset_resize (dst
, max (BITSET_SIZE_ (src1
), BITSET_SIZE_ (src2
)));
512 dsize
= VBITSET_SIZE (dst
);
513 ssize1
= VBITSET_SIZE (src1
);
514 ssize2
= VBITSET_SIZE (src2
);
515 dstp
= VBITSET_WORDS (dst
);
516 src1p
= VBITSET_WORDS (src1
);
517 src2p
= VBITSET_WORDS (src2
);
519 for (i
= 0; i
< min (ssize1
, ssize2
); i
++)
520 *dstp
++ = *src1p
++ & *src2p
++;
522 memset (dstp
, 0, sizeof (bitset_word
) * (dsize
- min (ssize1
, ssize2
)));
527 vbitset_and_cmp (bitset dst
, bitset src1
, bitset src2
)
534 bitset_windex ssize1
;
535 bitset_windex ssize2
;
538 vbitset_resize (dst
, max (BITSET_SIZE_ (src1
), BITSET_SIZE_ (src2
)));
540 dsize
= VBITSET_SIZE (dst
);
541 ssize1
= VBITSET_SIZE (src1
);
542 ssize2
= VBITSET_SIZE (src2
);
543 dstp
= VBITSET_WORDS (dst
);
544 src1p
= VBITSET_WORDS (src1
);
545 src2p
= VBITSET_WORDS (src2
);
547 for (i
= 0; i
< min (ssize1
, ssize2
); i
++, dstp
++)
549 bitset_word tmp
= *src1p
++ & *src2p
++;
564 for (; i
< ssize1
; i
++, dstp
++)
573 memset (dstp
, 0, sizeof (bitset_word
) * (dsize
- ssize1
));
580 vbitset_andn (bitset dst
, bitset src1
, bitset src2
)
586 bitset_windex ssize1
;
587 bitset_windex ssize2
;
590 vbitset_resize (dst
, max (BITSET_SIZE_ (src1
), BITSET_SIZE_ (src2
)));
592 dsize
= VBITSET_SIZE (dst
);
593 ssize1
= VBITSET_SIZE (src1
);
594 ssize2
= VBITSET_SIZE (src2
);
595 dstp
= VBITSET_WORDS (dst
);
596 src1p
= VBITSET_WORDS (src1
);
597 src2p
= VBITSET_WORDS (src2
);
599 for (i
= 0; i
< min (ssize1
, ssize2
); i
++)
600 *dstp
++ = *src1p
++ & ~(*src2p
++);
604 for (; i
< ssize2
; i
++)
607 memset (dstp
, 0, sizeof (bitset_word
) * (dsize
- ssize2
));
611 for (; i
< ssize1
; i
++)
614 memset (dstp
, 0, sizeof (bitset_word
) * (dsize
- ssize1
));
620 vbitset_andn_cmp (bitset dst
, bitset src1
, bitset src2
)
627 bitset_windex ssize1
;
628 bitset_windex ssize2
;
631 vbitset_resize (dst
, max (BITSET_SIZE_ (src1
), BITSET_SIZE_ (src2
)));
633 dsize
= VBITSET_SIZE (dst
);
634 ssize1
= VBITSET_SIZE (src1
);
635 ssize2
= VBITSET_SIZE (src2
);
636 dstp
= VBITSET_WORDS (dst
);
637 src1p
= VBITSET_WORDS (src1
);
638 src2p
= VBITSET_WORDS (src2
);
640 for (i
= 0; i
< min (ssize1
, ssize2
); i
++, dstp
++)
642 bitset_word tmp
= *src1p
++ & ~(*src2p
++);
653 for (; i
< ssize2
; i
++, dstp
++)
662 memset (dstp
, 0, sizeof (bitset_word
) * (dsize
- ssize2
));
666 for (; i
< ssize1
; i
++, dstp
++)
668 bitset_word tmp
= *src1p
++;
677 memset (dstp
, 0, sizeof (bitset_word
) * (dsize
- ssize1
));
685 vbitset_or (bitset dst
, bitset src1
, bitset src2
)
691 bitset_windex ssize1
;
692 bitset_windex ssize2
;
695 vbitset_resize (dst
, max (BITSET_SIZE_ (src1
), BITSET_SIZE_ (src2
)));
697 dsize
= VBITSET_SIZE (dst
);
698 ssize1
= VBITSET_SIZE (src1
);
699 ssize2
= VBITSET_SIZE (src2
);
700 dstp
= VBITSET_WORDS (dst
);
701 src1p
= VBITSET_WORDS (src1
);
702 src2p
= VBITSET_WORDS (src2
);
704 for (i
= 0; i
< min (ssize1
, ssize2
); i
++)
705 *dstp
++ = *src1p
++ | *src2p
++;
713 for (; i
< ssize1
; i
++)
716 memset (dstp
, 0, sizeof (bitset_word
) * (dsize
- ssize1
));
721 vbitset_or_cmp (bitset dst
, bitset src1
, bitset src2
)
728 bitset_windex ssize1
;
729 bitset_windex ssize2
;
732 vbitset_resize (dst
, max (BITSET_SIZE_ (src1
), BITSET_SIZE_ (src2
)));
734 dsize
= VBITSET_SIZE (dst
);
735 ssize1
= VBITSET_SIZE (src1
);
736 ssize2
= VBITSET_SIZE (src2
);
737 dstp
= VBITSET_WORDS (dst
);
738 src1p
= VBITSET_WORDS (src1
);
739 src2p
= VBITSET_WORDS (src2
);
741 for (i
= 0; i
< min (ssize1
, ssize2
); i
++, dstp
++)
743 bitset_word tmp
= *src1p
++ | *src2p
++;
758 for (; i
< ssize1
; i
++, dstp
++)
760 bitset_word tmp
= *src1p
++;
769 memset (dstp
, 0, sizeof (bitset_word
) * (dsize
- ssize1
));
776 vbitset_xor (bitset dst
, bitset src1
, bitset src2
)
782 bitset_windex ssize1
;
783 bitset_windex ssize2
;
786 vbitset_resize (dst
, max (BITSET_SIZE_ (src1
), BITSET_SIZE_ (src2
)));
788 dsize
= VBITSET_SIZE (dst
);
789 ssize1
= VBITSET_SIZE (src1
);
790 ssize2
= VBITSET_SIZE (src2
);
791 dstp
= VBITSET_WORDS (dst
);
792 src1p
= VBITSET_WORDS (src1
);
793 src2p
= VBITSET_WORDS (src2
);
795 for (i
= 0; i
< min (ssize1
, ssize2
); i
++)
796 *dstp
++ = *src1p
++ ^ *src2p
++;
804 for (; i
< ssize1
; i
++)
807 memset (dstp
, 0, sizeof (bitset_word
) * (dsize
- ssize1
));
812 vbitset_xor_cmp (bitset dst
, bitset src1
, bitset src2
)
819 bitset_windex ssize1
;
820 bitset_windex ssize2
;
823 vbitset_resize (dst
, max (BITSET_SIZE_ (src1
), BITSET_SIZE_ (src2
)));
825 dsize
= VBITSET_SIZE (dst
);
826 ssize1
= VBITSET_SIZE (src1
);
827 ssize2
= VBITSET_SIZE (src2
);
828 dstp
= VBITSET_WORDS (dst
);
829 src1p
= VBITSET_WORDS (src1
);
830 src2p
= VBITSET_WORDS (src2
);
832 for (i
= 0; i
< min (ssize1
, ssize2
); i
++, dstp
++)
834 bitset_word tmp
= *src1p
++ ^ *src2p
++;
849 for (; i
< ssize1
; i
++, dstp
++)
851 bitset_word tmp
= *src1p
++;
860 memset (dstp
, 0, sizeof (bitset_word
) * (dsize
- ssize1
));
866 /* FIXME, these operations need fixing for different size
870 vbitset_and_or (bitset dst
, bitset src1
, bitset src2
, bitset src3
)
879 if (BITSET_NBITS_ (src1
) != BITSET_NBITS_ (src2
)
880 || BITSET_NBITS_ (src1
) != BITSET_NBITS_ (src3
))
882 bitset_and_or_ (dst
, src1
, src2
, src3
);
886 vbitset_resize (dst
, BITSET_NBITS_ (src1
));
888 src1p
= VBITSET_WORDS (src1
);
889 src2p
= VBITSET_WORDS (src2
);
890 src3p
= VBITSET_WORDS (src3
);
891 dstp
= VBITSET_WORDS (dst
);
892 size
= VBITSET_SIZE (dst
);
894 for (i
= 0; i
< size
; i
++)
895 *dstp
++ = (*src1p
++ & *src2p
++) | *src3p
++;
900 vbitset_and_or_cmp (bitset dst
, bitset src1
, bitset src2
, bitset src3
)
910 if (BITSET_NBITS_ (src1
) != BITSET_NBITS_ (src2
)
911 || BITSET_NBITS_ (src1
) != BITSET_NBITS_ (src3
))
912 return bitset_and_or_cmp_ (dst
, src1
, src2
, src3
);
914 vbitset_resize (dst
, BITSET_NBITS_ (src1
));
916 src1p
= VBITSET_WORDS (src1
);
917 src2p
= VBITSET_WORDS (src2
);
918 src3p
= VBITSET_WORDS (src3
);
919 dstp
= VBITSET_WORDS (dst
);
920 size
= VBITSET_SIZE (dst
);
922 for (i
= 0; i
< size
; i
++, dstp
++)
924 bitset_word tmp
= (*src1p
++ & *src2p
++) | *src3p
++;
937 vbitset_andn_or (bitset dst
, bitset src1
, bitset src2
, bitset src3
)
946 if (BITSET_NBITS_ (src1
) != BITSET_NBITS_ (src2
)
947 || BITSET_NBITS_ (src1
) != BITSET_NBITS_ (src3
))
949 bitset_andn_or_ (dst
, src1
, src2
, src3
);
953 vbitset_resize (dst
, BITSET_NBITS_ (src1
));
955 src1p
= VBITSET_WORDS (src1
);
956 src2p
= VBITSET_WORDS (src2
);
957 src3p
= VBITSET_WORDS (src3
);
958 dstp
= VBITSET_WORDS (dst
);
959 size
= VBITSET_SIZE (dst
);
961 for (i
= 0; i
< size
; i
++)
962 *dstp
++ = (*src1p
++ & ~(*src2p
++)) | *src3p
++;
967 vbitset_andn_or_cmp (bitset dst
, bitset src1
, bitset src2
, bitset src3
)
977 if (BITSET_NBITS_ (src1
) != BITSET_NBITS_ (src2
)
978 || BITSET_NBITS_ (src1
) != BITSET_NBITS_ (src3
))
979 return bitset_andn_or_cmp_ (dst
, src1
, src2
, src3
);
981 vbitset_resize (dst
, BITSET_NBITS_ (src1
));
983 src1p
= VBITSET_WORDS (src1
);
984 src2p
= VBITSET_WORDS (src2
);
985 src3p
= VBITSET_WORDS (src3
);
986 dstp
= VBITSET_WORDS (dst
);
987 size
= VBITSET_SIZE (dst
);
989 for (i
= 0; i
< size
; i
++, dstp
++)
991 bitset_word tmp
= (*src1p
++ & ~(*src2p
++)) | *src3p
++;
1004 vbitset_or_and (bitset dst
, bitset src1
, bitset src2
, bitset src3
)
1013 if (BITSET_NBITS_ (src1
) != BITSET_NBITS_ (src2
)
1014 || BITSET_NBITS_ (src1
) != BITSET_NBITS_ (src3
))
1016 bitset_or_and_ (dst
, src1
, src2
, src3
);
1020 vbitset_resize (dst
, BITSET_NBITS_ (src1
));
1022 src1p
= VBITSET_WORDS (src1
);
1023 src2p
= VBITSET_WORDS (src2
);
1024 src3p
= VBITSET_WORDS (src3
);
1025 dstp
= VBITSET_WORDS (dst
);
1026 size
= VBITSET_SIZE (dst
);
1028 for (i
= 0; i
< size
; i
++)
1029 *dstp
++ = (*src1p
++ | *src2p
++) & *src3p
++;
1034 vbitset_or_and_cmp (bitset dst
, bitset src1
, bitset src2
, bitset src3
)
1044 if (BITSET_NBITS_ (src1
) != BITSET_NBITS_ (src2
)
1045 || BITSET_NBITS_ (src1
) != BITSET_NBITS_ (src3
))
1046 return bitset_or_and_cmp_ (dst
, src1
, src2
, src3
);
1048 vbitset_resize (dst
, BITSET_NBITS_ (src1
));
1050 src1p
= VBITSET_WORDS (src1
);
1051 src2p
= VBITSET_WORDS (src2
);
1052 src3p
= VBITSET_WORDS (src3
);
1053 dstp
= VBITSET_WORDS (dst
);
1054 size
= VBITSET_SIZE (dst
);
1056 for (i
= 0; i
< size
; i
++, dstp
++)
1058 bitset_word tmp
= (*src1p
++ | *src2p
++) & *src3p
++;
1071 vbitset_copy (bitset dst
, bitset src
)
1073 if (BITSET_COMPATIBLE_ (dst
, src
))
1074 vbitset_copy1 (dst
, src
);
1076 bitset_copy_ (dst
, src
);
1080 /* Vector of operations for multiple word bitsets. */
1081 struct bitset_vtable vbitset_vtable
= {
1108 vbitset_andn_or_cmp
,
1112 vbitset_list_reverse
,
1119 vbitset_bytes (n_bits
)
1120 bitset_bindex n_bits ATTRIBUTE_UNUSED
;
1122 return sizeof (struct vbitset_struct
);
1127 vbitset_init (bset
, n_bits
)
1129 bitset_bindex n_bits
;
1131 bset
->b
.vtable
= &vbitset_vtable
;
1135 VBITSET_SIZE (bset
) = 0;
1136 vbitset_resize (bset
, n_bits
);