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