xref: /netbsd-src/external/gpl3/binutils/dist/include/cgen/bitset.h (revision cb63e24e8d6aae7ddac1859a9015f48b1d8bd90e)
145548106Schristos /* Header file the type CGEN_BITSET.
2*cb63e24eSchristos    Copyright (C) 2002-2024 Free Software Foundation, Inc.
345548106Schristos 
445548106Schristos    This file is part of the GNU opcodes library.
545548106Schristos 
645548106Schristos    This library is free software; you can redistribute it and/or modify
745548106Schristos    it under the terms of the GNU General Public License as published by
845548106Schristos    the Free Software Foundation; either version 3, or (at your option)
945548106Schristos    any later version.
1045548106Schristos 
1145548106Schristos    It is distributed in the hope that it will be useful,
1245548106Schristos    but WITHOUT ANY WARRANTY; without even the implied warranty of
1345548106Schristos    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1445548106Schristos    GNU General Public License for more details.
1545548106Schristos 
1645548106Schristos    You should have received a copy of the GNU General Public License
1745548106Schristos    along with this library; see the file COPYING3.  If not, write to the
1845548106Schristos    Free Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA
1945548106Schristos    02110-1301, USA.  */
2045548106Schristos 
2145548106Schristos #ifndef CGEN_BITSET_H
2245548106Schristos #define CGEN_BITSET_H
2345548106Schristos 
2445548106Schristos #ifdef __cplusplus
2545548106Schristos extern "C" {
2645548106Schristos #endif
2745548106Schristos 
2845548106Schristos /* A bitmask represented as a string.
2945548106Schristos    Each member of the set is represented as a bit
3045548106Schristos    in the string. Bytes are indexed from left to right in the string and
3145548106Schristos    bits from most significant to least within each byte.
3245548106Schristos 
3345548106Schristos    For example, the bit representing member number 6 is (set->bits[0] & 0x02).
3445548106Schristos */
3545548106Schristos typedef struct cgen_bitset
3645548106Schristos {
3745548106Schristos   unsigned length;
3845548106Schristos   char *bits;
3945548106Schristos } CGEN_BITSET;
4045548106Schristos 
419573673dSchristos extern CGEN_BITSET *cgen_bitset_create (unsigned);
429573673dSchristos extern void cgen_bitset_init (CGEN_BITSET *, unsigned);
439573673dSchristos extern void cgen_bitset_clear (CGEN_BITSET *);
449573673dSchristos extern void cgen_bitset_add (CGEN_BITSET *, unsigned);
459573673dSchristos extern void cgen_bitset_set (CGEN_BITSET *, unsigned);
469573673dSchristos extern int cgen_bitset_compare (CGEN_BITSET *, CGEN_BITSET *);
479573673dSchristos extern void cgen_bitset_union (CGEN_BITSET *, CGEN_BITSET *, CGEN_BITSET *);
489573673dSchristos extern int cgen_bitset_intersect_p (CGEN_BITSET *, CGEN_BITSET *);
499573673dSchristos extern int cgen_bitset_contains (CGEN_BITSET *, unsigned);
509573673dSchristos extern CGEN_BITSET *cgen_bitset_copy (CGEN_BITSET *);
5145548106Schristos 
5245548106Schristos #ifdef __cplusplus
5345548106Schristos } // extern "C"
5445548106Schristos #endif
5545548106Schristos 
5645548106Schristos #endif
57