175fd0b74Schristos /* Header file the type CGEN_BITSET. 2*e992f068Schristos Copyright (C) 2002-2022 Free Software Foundation, Inc. 375fd0b74Schristos 475fd0b74Schristos This file is part of the GNU opcodes library. 575fd0b74Schristos 675fd0b74Schristos This library is free software; you can redistribute it and/or modify 775fd0b74Schristos it under the terms of the GNU General Public License as published by 875fd0b74Schristos the Free Software Foundation; either version 3, or (at your option) 975fd0b74Schristos any later version. 1075fd0b74Schristos 1175fd0b74Schristos It is distributed in the hope that it will be useful, 1275fd0b74Schristos but WITHOUT ANY WARRANTY; without even the implied warranty of 1375fd0b74Schristos MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 1475fd0b74Schristos GNU General Public License for more details. 1575fd0b74Schristos 1675fd0b74Schristos You should have received a copy of the GNU General Public License 1775fd0b74Schristos along with this library; see the file COPYING3. If not, write to the 1875fd0b74Schristos Free Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA 1975fd0b74Schristos 02110-1301, USA. */ 2075fd0b74Schristos 2175fd0b74Schristos #ifndef CGEN_BITSET_H 2275fd0b74Schristos #define CGEN_BITSET_H 2375fd0b74Schristos 2475fd0b74Schristos #ifdef __cplusplus 2575fd0b74Schristos extern "C" { 2675fd0b74Schristos #endif 2775fd0b74Schristos 2875fd0b74Schristos /* A bitmask represented as a string. 2975fd0b74Schristos Each member of the set is represented as a bit 3075fd0b74Schristos in the string. Bytes are indexed from left to right in the string and 3175fd0b74Schristos bits from most significant to least within each byte. 3275fd0b74Schristos 3375fd0b74Schristos For example, the bit representing member number 6 is (set->bits[0] & 0x02). 3475fd0b74Schristos */ 3575fd0b74Schristos typedef struct cgen_bitset 3675fd0b74Schristos { 3775fd0b74Schristos unsigned length; 3875fd0b74Schristos char *bits; 3975fd0b74Schristos } CGEN_BITSET; 4075fd0b74Schristos 4175fd0b74Schristos extern CGEN_BITSET *cgen_bitset_create (unsigned); 4275fd0b74Schristos extern void cgen_bitset_init (CGEN_BITSET *, unsigned); 4375fd0b74Schristos extern void cgen_bitset_clear (CGEN_BITSET *); 4475fd0b74Schristos extern void cgen_bitset_add (CGEN_BITSET *, unsigned); 4575fd0b74Schristos extern void cgen_bitset_set (CGEN_BITSET *, unsigned); 4675fd0b74Schristos extern int cgen_bitset_compare (CGEN_BITSET *, CGEN_BITSET *); 4775fd0b74Schristos extern void cgen_bitset_union (CGEN_BITSET *, CGEN_BITSET *, CGEN_BITSET *); 4875fd0b74Schristos extern int cgen_bitset_intersect_p (CGEN_BITSET *, CGEN_BITSET *); 4975fd0b74Schristos extern int cgen_bitset_contains (CGEN_BITSET *, unsigned); 5075fd0b74Schristos extern CGEN_BITSET *cgen_bitset_copy (CGEN_BITSET *); 5175fd0b74Schristos 5275fd0b74Schristos #ifdef __cplusplus 5375fd0b74Schristos } // extern "C" 5475fd0b74Schristos #endif 5575fd0b74Schristos 5675fd0b74Schristos #endif 57