1bb16d227Schristos /* Header file the type CGEN_BITSET. 2*8b657b07Schristos Copyright (C) 2002-2022 Free Software Foundation, Inc. 3bb16d227Schristos 4bb16d227Schristos This file is part of the GNU opcodes library. 5bb16d227Schristos 6bb16d227Schristos This library is free software; you can redistribute it and/or modify 7bb16d227Schristos it under the terms of the GNU General Public License as published by 8bb16d227Schristos the Free Software Foundation; either version 3, or (at your option) 9bb16d227Schristos any later version. 10bb16d227Schristos 11bb16d227Schristos It is distributed in the hope that it will be useful, 12bb16d227Schristos but WITHOUT ANY WARRANTY; without even the implied warranty of 13bb16d227Schristos MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14bb16d227Schristos GNU General Public License for more details. 15bb16d227Schristos 16bb16d227Schristos You should have received a copy of the GNU General Public License 17bb16d227Schristos along with this library; see the file COPYING3. If not, write to the 18bb16d227Schristos Free Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA 19bb16d227Schristos 02110-1301, USA. */ 20bb16d227Schristos 21bb16d227Schristos #ifndef CGEN_BITSET_H 22bb16d227Schristos #define CGEN_BITSET_H 23bb16d227Schristos 24bb16d227Schristos #ifdef __cplusplus 25bb16d227Schristos extern "C" { 26bb16d227Schristos #endif 27bb16d227Schristos 28bb16d227Schristos /* A bitmask represented as a string. 29bb16d227Schristos Each member of the set is represented as a bit 30bb16d227Schristos in the string. Bytes are indexed from left to right in the string and 31bb16d227Schristos bits from most significant to least within each byte. 32bb16d227Schristos 33bb16d227Schristos For example, the bit representing member number 6 is (set->bits[0] & 0x02). 34bb16d227Schristos */ 35bb16d227Schristos typedef struct cgen_bitset 36bb16d227Schristos { 37bb16d227Schristos unsigned length; 38bb16d227Schristos char *bits; 39bb16d227Schristos } CGEN_BITSET; 40bb16d227Schristos 41bb16d227Schristos extern CGEN_BITSET *cgen_bitset_create (unsigned); 42bb16d227Schristos extern void cgen_bitset_init (CGEN_BITSET *, unsigned); 43bb16d227Schristos extern void cgen_bitset_clear (CGEN_BITSET *); 44bb16d227Schristos extern void cgen_bitset_add (CGEN_BITSET *, unsigned); 45bb16d227Schristos extern void cgen_bitset_set (CGEN_BITSET *, unsigned); 46bb16d227Schristos extern int cgen_bitset_compare (CGEN_BITSET *, CGEN_BITSET *); 47bb16d227Schristos extern void cgen_bitset_union (CGEN_BITSET *, CGEN_BITSET *, CGEN_BITSET *); 48bb16d227Schristos extern int cgen_bitset_intersect_p (CGEN_BITSET *, CGEN_BITSET *); 49bb16d227Schristos extern int cgen_bitset_contains (CGEN_BITSET *, unsigned); 50bb16d227Schristos extern CGEN_BITSET *cgen_bitset_copy (CGEN_BITSET *); 51bb16d227Schristos 52bb16d227Schristos #ifdef __cplusplus 53bb16d227Schristos } // extern "C" 54bb16d227Schristos #endif 55bb16d227Schristos 56bb16d227Schristos #endif 57