X-Git-Url: https://git.saurik.com/bison.git/blobdiff_plain/7086e7071e8bfa2012e9134530a158c88a832ba6..1f916a78e6af829d8c2a8ec982f45aa7a30a9af5:/lib/bitset.h diff --git a/lib/bitset.h b/lib/bitset.h index 4afbbf4f..2e6eb8b0 100644 --- a/lib/bitset.h +++ b/lib/bitset.h @@ -1,5 +1,5 @@ /* Generic bitsets. - Copyright (C) 2002 Free Software Foundation, Inc. + Copyright (C) 2002, 2003 Free Software Foundation, Inc. Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz). This program is free software; you can redistribute it and/or modify @@ -19,363 +19,373 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef _BITSET_H #define _BITSET_H -#if HAVE_CONFIG_H -# include -#endif +/* This file is the public interface to the bitset abstract data type. + Only use the functions and macros defined in this file. */ + +#include "bbitset.h" -#define BITSET_STATS 1 - -# ifndef PARAMS -# if defined PROTOTYPES || (defined __STDC__ && __STDC__) -# define PARAMS(Args) Args -# else -# define PARAMS(Args) () -# endif -# endif - -# ifndef __attribute__ -# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 8) || __STRICT_ANSI__ -# define __attribute__(x) -# endif -# endif - -# ifndef ATTRIBUTE_NORETURN -# define ATTRIBUTE_NORETURN __attribute__ ((__noreturn__)) -# endif - -# ifndef ATTRIBUTE_UNUSED -# define ATTRIBUTE_UNUSED __attribute__ ((__unused__)) -# endif - -#include "bitset-int.h" -#include "sbitset.h" -#include "lbitset.h" -#include "ebitset.h" +/* obstack.h tries to be portable to K&R compilers, but its + __INT_TO_PTR macro generates diagnostics on compilers like Tru64 cc + that define __STDC__ to 0 when not in strict ANSI mode. The bitset + code assumes C89 or later, so it can avoid these glitches by + defining __INT_TO_PTR appropriately for C89 or later. */ +#ifndef __INT_TO_PTR +# define __INT_TO_PTR(P) ((void *) ((P) + (char *) 0)) +#endif #include "obstack.h" + #include -#include "xalloc.h" +/* Attributes used to select a bitset implementation. */ enum bitset_attr {BITSET_FIXED = 1, /* Bitset size fixed. */ BITSET_VARIABLE = 2, /* Bitset size variable. */ BITSET_DENSE = 4, /* Bitset dense. */ BITSET_SPARSE = 8, /* Bitset sparse. */ BITSET_FRUGAL = 16, /* Prefer most compact. */ - BITSET_GREEDY = 32}; /* Prefer fastest. */ + BITSET_GREEDY = 32}; /* Prefer fastest at memory expense. */ typedef unsigned int bitset_attrs; -/* The elements of these structures should be considered - to be private. */ -typedef struct bitset_struct +/* The contents of the union should be considered to be private. + While I would like to make this union opaque, it needs to be + visible for the inline bit set/test functions, and for delegation + to the proper implementation. */ +union bitset_union { - struct bitset_ops_struct *ops; - bitset_windex cindex; /* Cache word index. */ - bitset_windex csize; /* Cache size in words. */ - bitset_word *cdata; /* Cache data pointer. */ - union bitset_data + /* This must be the first member of every other structure that is a + member of this union. */ + struct bbitset_struct b; /* Base bitset data. */ + + struct abitset_struct { - struct sbitset_struct s; - struct lbitset_struct l; - struct ebitset_struct e; - } u; -} *bitset; + struct bbitset_struct b; + bitset_word words[1]; /* The array of bits. */ + } a; + struct ebitset_struct + { + struct bbitset_struct b; + bitset_windex size; /* Number of elements. */ + struct ebitset_elt_struct **elts; /* Expanding array of ptrs to elts. */ + } e; + + struct lbitset_struct + { + struct bbitset_struct b; + struct lbitset_elt_struct *head; /* First element in linked list. */ + struct lbitset_elt_struct *tail; /* Last element in linked list. */ + } l; + + struct bitset_stats_struct + { + struct bbitset_struct b; + bitset bset; + } s; + + struct vbitset_struct + { + struct bbitset_struct b; + bitset_windex size; /* Allocated size of array. */ + } v; -/* The contents of this structure should be considered private. */ -struct bitset_ops_struct -{ - void (*set) PARAMS ((struct bitset_struct *, bitset_bindex)); - void (*reset) PARAMS ((struct bitset_struct *, bitset_bindex)); - int (*test) PARAMS ((struct bitset_struct *, bitset_bindex)); - int (*size) PARAMS ((struct bitset_struct *)); - int (*op1) PARAMS ((struct bitset_struct *, enum bitset_ops)); - int (*op2) PARAMS ((struct bitset_struct *, struct bitset_struct *, - enum bitset_ops)); - int (*op3) PARAMS ((struct bitset_struct *, struct bitset_struct *, - struct bitset_struct *, enum bitset_ops)); - int (*op4) PARAMS ((struct bitset_struct *, struct bitset_struct *, - struct bitset_struct *, struct bitset_struct *, - enum bitset_ops)); - int (*list) PARAMS ((struct bitset_struct *, bitset_bindex *, - bitset_bindex, bitset_bindex *)); - int (*reverse_list) PARAMS ((struct bitset_struct *, bitset_bindex *, - bitset_bindex, bitset_bindex *)); - void (*free) PARAMS ((struct bitset_struct *)); - enum bitset_type type; }; +/* The contents of this structure should be considered private. + It is used for iterating over set bits. */ +typedef struct +{ + bitset_bindex list[BITSET_LIST_SIZE]; + bitset_bindex next; + bitset_bindex num; + bitset_bindex i; +} bitset_iterator; + + /* Return bytes required for bitset of desired type and size. */ -extern int bitset_bytes PARAMS ((enum bitset_type, bitset_bindex)); +extern size_t bitset_bytes PARAMS ((enum bitset_type, bitset_bindex)); /* Initialise a bitset with desired type and size. */ extern bitset bitset_init PARAMS ((bitset, bitset_bindex, enum bitset_type)); +/* Select an implementation type based on the desired bitset size + and attributes. */ extern enum bitset_type bitset_type_choose PARAMS ((bitset_bindex, bitset_attrs)); -/* Create a bitset of desired type and size. */ +/* Create a bitset of desired type and size. The bitset is zeroed. */ extern bitset bitset_alloc PARAMS ((bitset_bindex, enum bitset_type)); /* Free bitset. */ extern void bitset_free PARAMS ((bitset)); -/* Create a bitset of desired type and size using obstack. */ +/* Create a bitset of desired type and size using an obstack. The + bitset is zeroed. */ extern bitset bitset_obstack_alloc PARAMS ((struct obstack *bobstack, bitset_bindex, enum bitset_type)); /* Free bitset allocated on obstack. */ extern void bitset_obstack_free PARAMS ((bitset)); -/* Create a bitset of desired size and attributes. */ +/* Create a bitset of desired size and attributes. The bitset is zeroed. */ extern bitset bitset_create PARAMS ((bitset_bindex, bitset_attrs)); -/* Return size in bits of bitset SRC. */ -extern int bitset_size PARAMS ((bitset)); +/* Return bitset type. */ +extern enum bitset_type bitset_type_get PARAMS ((bitset)); + +/* Return bitset type name. */ +extern const char *bitset_type_name_get PARAMS ((bitset)); -#if BITSET_CACHE && BITSET_INLINE -static inline void bitset_set PARAMS ((bitset, bitset_bindex)); -static inline void bitset_reset PARAMS ((bitset, bitset_bindex)); -static inline int bitset_test PARAMS ((bitset, bitset_bindex)); /* Set bit BITNO in bitset BSET. */ -static inline void bitset_set (bset, bitno) - bitset bset; - bitset_bindex bitno; +static inline void +bitset_set (bitset bset, bitset_bindex bitno) { - bitset_windex index = bitno / BITSET_WORD_BITS; - bitset_windex offset = index - bset->cindex; + bitset_windex windex = bitno / BITSET_WORD_BITS; + bitset_windex offset = windex - bset->b.cindex; - if (offset < bset->csize) - bset->cdata[offset] |= (1 << (bitno % BITSET_WORD_BITS)); + if (offset < bset->b.csize) + bset->b.cdata[offset] |= ((bitset_word) 1 << (bitno % BITSET_WORD_BITS)); else - BITSET__SET (bset, bitno); + BITSET_SET_ (bset, bitno); } /* Reset bit BITNO in bitset BSET. */ -static inline void bitset_reset (bset, bitno) - bitset bset; - bitset_bindex bitno; +static inline void +bitset_reset (bitset bset, bitset_bindex bitno) { - bitset_windex index = bitno / BITSET_WORD_BITS; - bitset_windex offset = index - bset->cindex; + bitset_windex windex = bitno / BITSET_WORD_BITS; + bitset_windex offset = windex - bset->b.cindex; - if (offset < bset->csize) - bset->cdata[offset] &= ~(1 << (bitno % BITSET_WORD_BITS)); + if (offset < bset->b.csize) + bset->b.cdata[offset] &= ~((bitset_word) 1 << (bitno % BITSET_WORD_BITS)); else - BITSET__RESET (bset, bitno); + BITSET_RESET_ (bset, bitno); } /* Test bit BITNO in bitset BSET. */ -static inline int bitset_test (bset, bitno) - bitset bset; - bitset_bindex bitno; +static inline bool +bitset_test (bitset bset, bitset_bindex bitno) { - bitset_windex index = bitno / BITSET_WORD_BITS; - bitset_windex offset = index - bset->cindex; + bitset_windex windex = bitno / BITSET_WORD_BITS; + bitset_windex offset = windex - bset->b.cindex; - if (offset < bset->csize) - return (bset->cdata[offset] >> (bitno % BITSET_WORD_BITS)) & 1; + if (offset < bset->b.csize) + return (bset->b.cdata[offset] >> (bitno % BITSET_WORD_BITS)) & 1; else - return BITSET__TEST (bset, bitno); + return BITSET_TEST_ (bset, bitno); } -#endif -#if BITSET_CACHE && ! BITSET_INLINE - -/* Set bit BITNO in bitset BSET. */ -#define bitset_set(bset, bitno) \ -do \ -{ \ - bitset_bindex _bitno = (bitno); \ - bitset_windex _index = _bitno / BITSET_WORD_BITS; \ - bitset_windex _offset = _index - (bset)->cindex; \ - \ - if (_offset < (bset)->csize) \ - (bset)->cdata[_offset] |= (1 << (_bitno % BITSET_WORD_BITS)); \ - else \ - BITSET__SET ((bset), _bitno); \ -} while (0) +/* Toggle bit BITNO in bitset BSET and return non-zero if now set. */ +#define bitset_toggle(bset, bitno) BITSET_TOGGLE_ (bset, bitno) -/* Reset bit BITNO in bitset BSET. */ -#define bitset_reset(bset, bitno) \ -do \ -{ \ - bitset_bindex _bitno = (bitno); \ - bitset_windex _index = _bitno / BITSET_WORD_BITS; \ - bitset_windex _offset = _index - (bset)->cindex; \ - \ - if (_offset < (bset)->csize) \ - (bset)->cdata[_offset] &= ~(1 << (_bitno % BITSET_WORD_BITS)); \ - else \ - BITSET__RESET ((bset), _bitno); \ -} while (0) +/* Return size in bits of bitset SRC. */ +#define bitset_size(SRC) BITSET_SIZE_ (SRC) +/* Change size of bitset. */ +extern void bitset_resize PARAMS ((bitset, bitset_bindex)); -/* Test bit BITNO in bitset BSET. */ -#define bitset_test(bset, bitno) \ -(((((bitno) / BITSET_WORD_BITS) - (bset)->cindex) < (bset)->csize) \ - ? ((bset)->cdata[(((bitno) / BITSET_WORD_BITS) - (bset)->cindex)] \ - >> ((bitno) % BITSET_WORD_BITS)) & 1 \ - : (unsigned int) BITSET__TEST ((bset), (bitno))) -#endif +/* Return number of bits set in bitset SRC. */ +#define bitset_count(SRC) BITSET_COUNT_ (SRC) -#if ! BITSET_CACHE -/* Set bit BITNO in bitset SRC. */ -#define bitset_set(SRC, BITNO) BITSET__SET (SRC, BITNO) -/* Reset bit BITNO in bitset SRC. */ -#define bitset_reset(SRC, BITNO) BITSET__RESET (SRC, BITNO) +/* Return SRC == 0. */ +#define bitset_empty_p(SRC) BITSET_EMPTY_P_ (SRC) -/* Return non-zero if bit BITNO in bitset SRC is set. */ -#define bitset_test(SRC, BITNO) BITSET__TEST (SRC, BITNO) -#endif +/* DST = ~0. */ +#define bitset_ones(DST) BITSET_ONES_ (DST) /* DST = 0. */ -extern int bitset_zero PARAMS ((bitset)); +#define bitset_zero(DST) BITSET_ZERO_ (DST) -/* DST = ~0. */ -extern int bitset_ones PARAMS ((bitset)); -/* Return non-zero if all bits in bitset SRC are reset. */ -extern int bitset_empty_p PARAMS ((bitset)); -/* Return DST == DST | SRC. */ -extern int bitset_subset_p PARAMS ((bitset, bitset)); +/* DST = SRC. */ +#define bitset_copy(DST, SRC) BITSET_COPY_ (DST, SRC) -/* Return DST == SRC. */ -extern int bitset_equal_p PARAMS ((bitset, bitset)); +/* Return DST & SRC == 0. */ +#define bitset_disjoint_p(DST, SRC) BITSET_DISJOINT_P_ (DST, SRC) -/* DST == SRC. */ -extern int bitset_copy PARAMS ((bitset, bitset)); +/* Return DST == SRC. */ +#define bitset_equal_p(DST, SRC) BITSET_EQUAL_P_ (DST, SRC) /* DST = ~SRC. */ -extern int bitset_not PARAMS ((bitset, bitset)); +#define bitset_not(DST, SRC) BITSET_NOT_ (DST, SRC) + +/* Return DST == DST | SRC. */ +#define bitset_subset_p(DST, SRC) BITSET_SUBSET_P_ (DST, SRC) + -/* DST = SRC1 | SRC2. Return non-zero if DST != SRC1 | SRC2. */ -extern int bitset_or PARAMS ((bitset, bitset, bitset)); + +/* DST = SRC1 & SRC2. */ +#define bitset_and(DST, SRC1, SRC2) BITSET_AND_ (DST, SRC1, SRC2) /* DST = SRC1 & SRC2. Return non-zero if DST != SRC1 & SRC2. */ -extern int bitset_and PARAMS ((bitset, bitset, bitset)); +#define bitset_and_cmp(DST, SRC1, SRC2) BITSET_AND_CMP_ (DST, SRC1, SRC2) -/* DST = SRC1 ^ SRC2. Return non-zero if DST != SRC1 ^ SRC2. */ -extern int bitset_xor PARAMS ((bitset, bitset, bitset)); +/* DST = SRC1 & ~SRC2. */ +#define bitset_andn(DST, SRC1, SRC2) BITSET_ANDN_ (DST, SRC1, SRC2) /* DST = SRC1 & ~SRC2. Return non-zero if DST != SRC1 & ~SRC2. */ -extern int bitset_andn PARAMS ((bitset, bitset, bitset)); +#define bitset_andn_cmp(DST, SRC1, SRC2) BITSET_ANDN_CMP_ (DST, SRC1, SRC2) + +/* DST = SRC1 | SRC2. */ +#define bitset_or(DST, SRC1, SRC2) BITSET_OR_ (DST, SRC1, SRC2) + +/* DST = SRC1 | SRC2. Return non-zero if DST != SRC1 | SRC2. */ +#define bitset_or_cmp(DST, SRC1, SRC2) BITSET_OR_CMP_ (DST, SRC1, SRC2) + +/* DST = SRC1 ^ SRC2. */ +#define bitset_xor(DST, SRC1, SRC2) BITSET_XOR_ (DST, SRC1, SRC2) + +/* DST = SRC1 ^ SRC2. Return non-zero if DST != SRC1 ^ SRC2. */ +#define bitset_xor_cmp(DST, SRC1, SRC2) BITSET_XOR_CMP_ (DST, SRC1, SRC2) -/* DST = SRC1 | ~SRC2. Return non-zero if DST != SRC1 | ~SRC2. */ -extern int bitset_orn PARAMS ((bitset, bitset, bitset)); -/* DST = (SRC1 | SRC2) & SRC3. Return non-zero if - DST != (SRC1 | SRC2) & SRC3. */ -extern int bitset_or_and PARAMS ((bitset, bitset, bitset, bitset)); + +/* DST = (SRC1 & SRC2) | SRC3. */ +#define bitset_and_or(DST, SRC1, SRC2, SRC3) \ + BITSET_AND_OR_ (DST, SRC1, SRC2, SRC3) /* DST = (SRC1 & SRC2) | SRC3. Return non-zero if DST != (SRC1 & SRC2) | SRC3. */ -extern int bitset_and_or PARAMS ((bitset, bitset, bitset, bitset)); +#define bitset_and_or_cmp(DST, SRC1, SRC2, SRC3) \ + BITSET_AND_OR_CMP_ (DST, SRC1, SRC2, SRC3) + +/* DST = (SRC1 & ~SRC2) | SRC3. */ +#define bitset_andn_or(DST, SRC1, SRC2, SRC3) \ + BITSET_ANDN_OR_ (DST, SRC1, SRC2, SRC3) /* DST = (SRC1 & ~SRC2) | SRC3. Return non-zero if DST != (SRC1 & ~SRC2) | SRC3. */ -#define bitset_andn_or(DST, SRC1, SRC2, SRC3) \ +#define bitset_andn_or_cmp(DST, SRC1, SRC2, SRC3) \ + BITSET_ANDN_OR_CMP_ (DST, SRC1, SRC2, SRC3) -/* Find next bit set in BSET starting from and including BITNO. */ -extern int bitset_next PARAMS ((bitset, bitset_bindex)); +/* DST = (SRC1 | SRC2) & SRC3. */ +#define bitset_or_and(DST, SRC1, SRC2, SRC3)\ + BITSET_OR_AND_ (DST, SRC1, SRC2, SRC3) -/* Find previous bit set in BSET starting from and including BITNO. */ -extern int bitset_prev PARAMS ((bitset, bitset_bindex)); +/* DST = (SRC1 | SRC2) & SRC3. Return non-zero if + DST != (SRC1 | SRC2) & SRC3. */ +#define bitset_or_and_cmp(DST, SRC1, SRC2, SRC3)\ + BITSET_OR_AND_CMP_ (DST, SRC1, SRC2, SRC3) /* Find list of up to NUM bits set in BSET starting from and including *NEXT. Return with actual number of bits found and with *NEXT indicating where search stopped. */ -#if BITSET_STATS -extern int bitset_list PARAMS ((bitset, bitset_bindex *, bitset_bindex, - bitset_bindex *)); -#else #define bitset_list(BSET, LIST, NUM, NEXT) \ -BITSET__LIST (BSET, LIST, NUM, NEXT) -#endif + BITSET_LIST_ (BSET, LIST, NUM, NEXT) /* Find reverse list of up to NUM bits set in BSET starting from and including NEXT. Return with actual number of bits found and with *NEXT indicating where search stopped. */ -#define bitset_reverse_list(BSET, LIST, NUM, NEXT) \ -BITSET__REVERSE_LIST (BSET, LIST, NUM, NEXT) +#define bitset_list_reverse(BSET, LIST, NUM, NEXT) \ + BITSET_LIST_REVERSE_ (BSET, LIST, NUM, NEXT) + +/* Return true if both bitsets are of the same type and size. */ +extern bool bitset_compatible_p (bitset bset1, bitset bset2); + +/* Find next set bit from the given bit index. */ +extern bitset_bindex bitset_next PARAMS ((bitset, bitset_bindex)); + +/* Find previous set bit from the given bit index. */ +extern bitset_bindex bitset_prev PARAMS ((bitset, bitset_bindex)); /* Find first set bit. */ -extern int bitset_first PARAMS ((bitset)); +extern bitset_bindex bitset_first PARAMS ((bitset)); /* Find last set bit. */ -extern int bitset_last PARAMS ((bitset)); +extern bitset_bindex bitset_last PARAMS ((bitset)); + +/* Return nonzero if this is the only set bit. */ +extern bool bitset_only_set_p PARAMS ((bitset, bitset_bindex)); /* Dump bitset. */ extern void bitset_dump PARAMS ((FILE *, bitset)); -/* Loop over all elements of BSET, starting with MIN, executing CODE. */ -#define BITSET_EXECUTE(BSET, MIN, N, CODE) \ -do { \ - bitset_bindex _list[BITSET_LIST_SIZE]; \ - bitset_bindex _next = (MIN); \ - int _num; \ - \ - while ((_num = bitset_list ((BSET), _list, BITSET_LIST_SIZE, &_next)))\ - { \ - int _i; \ - \ - for (_i = 0; _i < _num; _i++) \ - { \ - (N) = _list[_i]; \ - CODE; \ - } \ - if (_num < BITSET_LIST_SIZE) \ - break; \ - } \ -} while (0) +/* Loop over all elements of BSET, starting with MIN, setting INDEX + to the index of each set bit. For example, the following will print + the bits set in a bitset: + + bitset_bindex i; + bitset_iterator iter; + + BITSET_FOR_EACH (iter, src, i, 0) + { + printf ("%lu ", (unsigned long int) i); + }; +*/ +#define BITSET_FOR_EACH(ITER, BSET, INDEX, MIN) \ + for (ITER.next = (MIN), ITER.num = BITSET_LIST_SIZE; \ + (ITER.num == BITSET_LIST_SIZE) \ + && (ITER.num = bitset_list (BSET, ITER.list, \ + BITSET_LIST_SIZE, &ITER.next));) \ + for (ITER.i = 0; \ + ITER.i < ITER.num && ((INDEX) = ITER.list[ITER.i], 1); \ + ITER.i++) /* Loop over all elements of BSET, in reverse order starting with - MIN, executing CODE. */ -#define BITSET_REVERSE_EXECUTE(BSET, MIN, N, CODE) \ -do { \ - bitset_bindex _list[BITSET_LIST_SIZE]; \ - bitset_bindex _next = (MIN); \ - int _num; \ - \ - while ((_num = bitset_reverse_list ((BSET), _list, \ - BITSET_LIST_SIZE, &_next))) \ - { \ - int _i; \ - \ - for (_i = 0; _i < _num; _i++) \ - { \ - (N) = _list[_i]; \ - CODE; \ - } \ - if (_num < BITSET_LIST_SIZE) \ - break; \ - } \ -} while (0) - - -/* Define set operations in terms of bit operations. */ - -#define bitset_diff(DST, SRC1, SRC2) bitset_andn (DST, SRC1, SRC2) - -#define bitset_intersection(DST, SRC1, SRC2) bitset_and (DST, SRC1, SRC2) - -#define bitset_union(DST, SRC1, SRC2) bitset_or (DST, SRC1, SRC2) + MIN, setting INDEX to the index of each set bit. For example, the + following will print the bits set in a bitset in reverse order: + + bitset_bindex i; + bitset_iterator iter; + + BITSET_FOR_EACH_REVERSE (iter, src, i, 0) + { + printf ("%lu ", (unsigned long int) i); + }; +*/ +#define BITSET_FOR_EACH_REVERSE(ITER, BSET, INDEX, MIN) \ + for (ITER.next = (MIN), ITER.num = BITSET_LIST_SIZE; \ + (ITER.num == BITSET_LIST_SIZE) \ + && (ITER.num = bitset_list_reverse (BSET, ITER.list, \ + BITSET_LIST_SIZE, &ITER.next));) \ + for (ITER.i = 0; \ + ITER.i < ITER.num && ((INDEX) = ITER.list[ITER.i], 1); \ + ITER.i++) + + +/* Define set operations in terms of logical operations. */ + +#define bitset_diff(DST, SRC1, SRC2) bitset_andn (DST, SRC1, SRC2) +#define bitset_diff_cmp(DST, SRC1, SRC2) bitset_andn_cmp (DST, SRC1, SRC2) + +#define bitset_intersection(DST, SRC1, SRC2) bitset_and (DST, SRC1, SRC2) +#define bitset_intersection_cmp(DST, SRC1, SRC2) bitset_and_cmp (DST, SRC1, SRC2) + +#define bitset_union(DST, SRC1, SRC2) bitset_or (DST, SRC1, SRC2) +#define bitset_union_cmp(DST, SRC1, SRC2) bitset_or_cmp (DST, SRC1, SRC2) +/* Symmetrical difference. */ +#define bitset_symdiff(DST, SRC1, SRC2) bitset_xor (DST, SRC1, SRC2) +#define bitset_symdiff_cmp(DST, SRC1, SRC2) bitset_xor_cmp (DST, SRC1, SRC2) + +/* Union of difference. */ #define bitset_diff_union(DST, SRC1, SRC2, SRC3) \ -bitset_andn_or (DST, SRC1, SRC2, SRC3) + bitset_andn_or (DST, SRC1, SRC2, SRC3) +#define bitset_diff_union_cmp(DST, SRC1, SRC2, SRC3) \ + bitset_andn_or_cmp (DST, SRC1, SRC2, SRC3) + /* Release any memory tied up with bitsets. */ extern void bitset_release_memory PARAMS ((void)); -/* Initialise bitset stats. */ -extern void bitset_stats_init PARAMS ((void)); +/* Enable bitset stats gathering. */ +extern void bitset_stats_enable PARAMS ((void)); + +/* Disable bitset stats gathering. */ +extern void bitset_stats_disable PARAMS ((void)); + +/* Read bitset stats file of accummulated stats. */ +void bitset_stats_read PARAMS ((const char *filename)); + +/* Write bitset stats file of accummulated stats. */ +void bitset_stats_write PARAMS ((const char *filename)); /* Dump bitset stats. */ extern void bitset_stats_dump PARAMS ((FILE *)); @@ -386,10 +396,5 @@ extern void debug_bitset PARAMS ((bitset)); /* Function to debug bitset stats from debugger. */ extern void debug_bitset_stats PARAMS ((void)); -extern bitset sbitset_init PARAMS ((bitset, bitset_bindex)); - -extern bitset lbitset_init PARAMS ((bitset, bitset_bindex)); - -extern bitset ebitset_init PARAMS ((bitset, bitset_bindex)); - #endif /* _BITSET_H */ +