1cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project/* Generic bitsets.
2cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project   Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
3cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project   Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz).
4cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project
5cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source ProjectThis program is free software; you can redistribute it and/or modify
6cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Projectit under the terms of the GNU General Public License as published by
7cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Projectthe Free Software Foundation; either version 2 of the License, or
8cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project(at your option) any later version.
9cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project
10cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source ProjectThis program is distributed in the hope that it will be useful,
11cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Projectbut WITHOUT ANY WARRANTY; without even the implied warranty of
12cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source ProjectMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source ProjectGNU General Public License for more details.
14cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project
15cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source ProjectYou should have received a copy of the GNU General Public License
16cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Projectalong with this program; if not, write to the Free Software
17cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source ProjectFoundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
18cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project
19cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project#ifndef _BITSET_H
20cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project#define _BITSET_H
21cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project
22cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project/* This file is the public interface to the bitset abstract data type.
23cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project   Only use the functions and macros defined in this file.  */
24cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project
25cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project#include "bbitset.h"
26cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project#include "obstack.h"
27cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project#include <stdio.h>
28cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project
29cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project#if USE_UNLOCKED_IO
30cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project# include "unlocked-io.h"
31cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project#endif
32cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project
33cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project/* Attributes used to select a bitset implementation.  */
34cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Projectenum bitset_attr {BITSET_FIXED = 1,    /* Bitset size fixed.  */
35cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project		  BITSET_VARIABLE = 2, /* Bitset size variable.  */
36cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project		  BITSET_DENSE = 4,    /* Bitset dense.  */
37cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project		  BITSET_SPARSE = 8,   /* Bitset sparse.  */
38cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project		  BITSET_FRUGAL = 16,  /* Prefer most compact.  */
39cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project		  BITSET_GREEDY = 32}; /* Prefer fastest at memory expense.  */
40cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project
41cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Projecttypedef unsigned int bitset_attrs;
42cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project
43cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project/* The contents of the union should be considered to be private.
44cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project   While I would like to make this union opaque, it needs to be
45cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project   visible for the inline bit set/test functions, and for delegation
46cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project   to the proper implementation.  */
47cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Projectunion bitset_union
48cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project{
49cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project  /* This must be the first member of every other structure that is a
50cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project     member of this union.  */
51cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project  struct bbitset_struct b;	        /* Base bitset data.  */
52cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project
53cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project  struct abitset_struct
54cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project  {
55cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project    struct bbitset_struct b;
56cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project    bitset_word words[1];		/* The array of bits.  */
57cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project  } a;
58cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project
59cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project  struct ebitset_struct
60cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project  {
61cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project    struct bbitset_struct b;
62cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project    bitset_windex size;			/* Number of elements.  */
63cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project    struct ebitset_elt_struct **elts;	/* Expanding array of ptrs to elts.  */
64cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project  } e;
65cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project
66cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project  struct lbitset_struct
67cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project  {
68cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project    struct bbitset_struct b;
69cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project    struct lbitset_elt_struct *head;	/* First element in linked list.  */
70cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project    struct lbitset_elt_struct *tail;	/* Last element in linked list.  */
71cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project  } l;
72cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project
73cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project  struct bitset_stats_struct
74cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project  {
75cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project    struct bbitset_struct b;
76cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project    bitset bset;
77cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project  } s;
78cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project
79cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project  struct vbitset_struct
80cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project  {
81cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project    struct bbitset_struct b;
82cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project    bitset_windex size;			/* Allocated size of array.  */
83cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project  } v;
84cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project
85cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project};
86cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project
87cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project
88cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project/* The contents of this structure should be considered private.
89cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project   It is used for iterating over set bits.  */
90cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Projecttypedef struct
91cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project{
92cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project  bitset_bindex list[BITSET_LIST_SIZE];
93cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project  bitset_bindex next;
94cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project  bitset_bindex num;
95cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project  bitset_bindex i;
96cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project} bitset_iterator;
97cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project
98cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project
99cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project/* Return bytes required for bitset of desired type and size.  */
100cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Projectextern size_t bitset_bytes (enum bitset_type, bitset_bindex);
101cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project
102cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project/* Initialise a bitset with desired type and size.  */
103cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Projectextern bitset bitset_init (bitset, bitset_bindex, enum bitset_type);
104cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project
105cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project/* Select an implementation type based on the desired bitset size
106cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project   and attributes.  */
107cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Projectextern enum bitset_type bitset_type_choose (bitset_bindex, bitset_attrs);
108cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project
109cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project/* Create a bitset of desired type and size.  The bitset is zeroed.  */
110cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Projectextern bitset bitset_alloc (bitset_bindex, enum bitset_type);
111cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project
112cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project/* Free bitset.  */
113cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Projectextern void bitset_free (bitset);
114cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project
115cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project/* Create a bitset of desired type and size using an obstack.  The
116cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project   bitset is zeroed.  */
117cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Projectextern bitset bitset_obstack_alloc (struct obstack *bobstack,
118cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project				    bitset_bindex, enum bitset_type);
119cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project
120cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project/* Free bitset allocated on obstack.  */
121cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Projectextern void bitset_obstack_free (bitset);
122cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project
123cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project/* Create a bitset of desired size and attributes.  The bitset is zeroed.  */
124cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Projectextern bitset bitset_create (bitset_bindex, bitset_attrs);
125cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project
126cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project/* Return bitset type.  */
127cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Projectextern enum bitset_type bitset_type_get (bitset);
128cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project
129cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project/* Return bitset type name.  */
130cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Projectextern const char *bitset_type_name_get (bitset);
131cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project
132cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project
133cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project/* Set bit BITNO in bitset BSET.  */
134cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Projectstatic inline void
135cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Projectbitset_set (bitset bset, bitset_bindex bitno)
136cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project{
137cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project  bitset_windex windex = bitno / BITSET_WORD_BITS;
138cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project  bitset_windex offset = windex - bset->b.cindex;
139cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project
140cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project  if (offset < bset->b.csize)
141cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project    bset->b.cdata[offset] |= ((bitset_word) 1 << (bitno % BITSET_WORD_BITS));
142cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project  else
143cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project    BITSET_SET_ (bset, bitno);
144cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project}
145cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project
146cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project
147cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project/* Reset bit BITNO in bitset BSET.  */
148cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Projectstatic inline void
149cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Projectbitset_reset (bitset bset, bitset_bindex bitno)
150cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project{
151cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project  bitset_windex windex = bitno / BITSET_WORD_BITS;
152cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project  bitset_windex offset = windex - bset->b.cindex;
153cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project
154cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project  if (offset < bset->b.csize)
155cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project    bset->b.cdata[offset] &= ~((bitset_word) 1 << (bitno % BITSET_WORD_BITS));
156cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project  else
157cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project    BITSET_RESET_ (bset, bitno);
158cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project}
159cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project
160cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project
161cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project/* Test bit BITNO in bitset BSET.  */
162cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Projectstatic inline bool
163cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Projectbitset_test (bitset bset, bitset_bindex bitno)
164cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project{
165cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project  bitset_windex windex = bitno / BITSET_WORD_BITS;
166cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project  bitset_windex offset = windex - bset->b.cindex;
167cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project
168cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project  if (offset < bset->b.csize)
169cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project    return (bset->b.cdata[offset] >> (bitno % BITSET_WORD_BITS)) & 1;
170cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project  else
171cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project    return BITSET_TEST_ (bset, bitno);
172cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project}
173cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project
174cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project
175cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project/* Toggle bit BITNO in bitset BSET and return non-zero if now set.  */
176cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project#define bitset_toggle(bset, bitno) BITSET_TOGGLE_ (bset, bitno)
177cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project
178cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project/* Return size in bits of bitset SRC.  */
179cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project#define bitset_size(SRC) BITSET_SIZE_ (SRC)
180cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project
181cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project/* Change size of bitset.  */
182cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Projectextern void bitset_resize (bitset, bitset_bindex);
183cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project
184cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project/* Return number of bits set in bitset SRC.  */
185cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project#define bitset_count(SRC) BITSET_COUNT_ (SRC)
186cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project
187cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project
188cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project/* Return SRC == 0.  */
189cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project#define bitset_empty_p(SRC) BITSET_EMPTY_P_ (SRC)
190cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project
191cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project/* DST = ~0.  */
192cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project#define bitset_ones(DST) BITSET_ONES_ (DST)
193cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project
194cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project/* DST = 0.  */
195cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project#define bitset_zero(DST) BITSET_ZERO_ (DST)
196cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project
197cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project
198cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project
199cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project/* DST = SRC.  */
200cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project#define bitset_copy(DST, SRC) BITSET_COPY_ (DST, SRC)
201cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project
202cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project/* Return DST & SRC == 0.  */
203cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project#define bitset_disjoint_p(DST, SRC) BITSET_DISJOINT_P_ (DST, SRC)
204cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project
205cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project/* Return DST == SRC.  */
206cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project#define bitset_equal_p(DST, SRC) BITSET_EQUAL_P_ (DST, SRC)
207cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project
208cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project/* DST = ~SRC.  */
209cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project#define bitset_not(DST, SRC) BITSET_NOT_ (DST, SRC)
210cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project
211cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project/* Return DST == DST | SRC.  */
212cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project#define bitset_subset_p(DST, SRC) BITSET_SUBSET_P_ (DST, SRC)
213cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project
214cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project
215cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project
216cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project/* DST = SRC1 & SRC2.  */
217cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project#define bitset_and(DST, SRC1, SRC2) BITSET_AND_ (DST, SRC1, SRC2)
218cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project
219cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project/* DST = SRC1 & SRC2.  Return non-zero if DST != SRC1 & SRC2.  */
220cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project#define bitset_and_cmp(DST, SRC1, SRC2) BITSET_AND_CMP_ (DST, SRC1, SRC2)
221cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project
222cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project/* DST = SRC1 & ~SRC2.  */
223cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project#define bitset_andn(DST, SRC1, SRC2) BITSET_ANDN_ (DST, SRC1, SRC2)
224cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project
225cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project/* DST = SRC1 & ~SRC2.  Return non-zero if DST != SRC1 & ~SRC2.  */
226cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project#define bitset_andn_cmp(DST, SRC1, SRC2) BITSET_ANDN_CMP_ (DST, SRC1, SRC2)
227cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project
228cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project/* DST = SRC1 | SRC2.  */
229cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project#define bitset_or(DST, SRC1, SRC2) BITSET_OR_ (DST, SRC1, SRC2)
230cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project
231cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project/* DST = SRC1 | SRC2.  Return non-zero if DST != SRC1 | SRC2.  */
232cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project#define bitset_or_cmp(DST, SRC1, SRC2) BITSET_OR_CMP_ (DST, SRC1, SRC2)
233cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project
234cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project/* DST = SRC1 ^ SRC2.  */
235cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project#define bitset_xor(DST, SRC1, SRC2) BITSET_XOR_ (DST, SRC1, SRC2)
236cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project
237cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project/* DST = SRC1 ^ SRC2.  Return non-zero if DST != SRC1 ^ SRC2.  */
238cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project#define bitset_xor_cmp(DST, SRC1, SRC2) BITSET_XOR_CMP_ (DST, SRC1, SRC2)
239cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project
240cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project
241cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project
242cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project/* DST = (SRC1 & SRC2) | SRC3.  */
243cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project#define bitset_and_or(DST, SRC1, SRC2, SRC3) \
244cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project BITSET_AND_OR_ (DST, SRC1, SRC2, SRC3)
245cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project
246cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project/* DST = (SRC1 & SRC2) | SRC3.  Return non-zero if
247cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project   DST != (SRC1 & SRC2) | SRC3.  */
248cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project#define bitset_and_or_cmp(DST, SRC1, SRC2, SRC3) \
249cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project BITSET_AND_OR_CMP_ (DST, SRC1, SRC2, SRC3)
250cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project
251cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project/* DST = (SRC1 & ~SRC2) | SRC3.  */
252cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project#define bitset_andn_or(DST, SRC1, SRC2, SRC3) \
253cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project BITSET_ANDN_OR_ (DST, SRC1, SRC2, SRC3)
254cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project
255cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project/* DST = (SRC1 & ~SRC2) | SRC3.  Return non-zero if
256cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project   DST != (SRC1 & ~SRC2) | SRC3.  */
257cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project#define bitset_andn_or_cmp(DST, SRC1, SRC2, SRC3) \
258cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project BITSET_ANDN_OR_CMP_ (DST, SRC1, SRC2, SRC3)
259cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project
260cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project/* DST = (SRC1 | SRC2) & SRC3.  */
261cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project#define bitset_or_and(DST, SRC1, SRC2, SRC3)\
262cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project BITSET_OR_AND_ (DST, SRC1, SRC2, SRC3)
263cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project
264cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project/* DST = (SRC1 | SRC2) & SRC3.  Return non-zero if
265cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project   DST != (SRC1 | SRC2) & SRC3.  */
266cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project#define bitset_or_and_cmp(DST, SRC1, SRC2, SRC3)\
267cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project BITSET_OR_AND_CMP_ (DST, SRC1, SRC2, SRC3)
268cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project
269cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project/* Find list of up to NUM bits set in BSET starting from and including
270cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project   *NEXT.  Return with actual number of bits found and with *NEXT
271cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project   indicating where search stopped.  */
272cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project#define bitset_list(BSET, LIST, NUM, NEXT) \
273cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project BITSET_LIST_ (BSET, LIST, NUM, NEXT)
274cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project
275cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project/* Find reverse list of up to NUM bits set in BSET starting from and
276cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project   including NEXT.  Return with actual number of bits found and with
277cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project   *NEXT indicating where search stopped.  */
278cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project#define bitset_list_reverse(BSET, LIST, NUM, NEXT) \
279cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project BITSET_LIST_REVERSE_ (BSET, LIST, NUM, NEXT)
280cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project
281cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project/* Return true if both bitsets are of the same type and size.  */
282cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Projectextern bool bitset_compatible_p (bitset bset1, bitset bset2);
283cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project
284cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project/* Find next set bit from the given bit index.  */
285cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Projectextern bitset_bindex bitset_next (bitset, bitset_bindex);
286cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project
287cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project/* Find previous set bit from the given bit index.  */
288cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Projectextern bitset_bindex bitset_prev (bitset, bitset_bindex);
289cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project
290cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project/* Find first set bit.  */
291cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Projectextern bitset_bindex bitset_first (bitset);
292cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project
293cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project/* Find last set bit.  */
294cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Projectextern bitset_bindex bitset_last (bitset);
295cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project
296cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project/* Return nonzero if this is the only set bit.  */
297cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Projectextern bool bitset_only_set_p (bitset, bitset_bindex);
298cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project
299cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project/* Dump bitset.  */
300cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Projectextern void bitset_dump (FILE *, bitset);
301cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project
302cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project/* Loop over all elements of BSET, starting with MIN, setting INDEX
303cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project   to the index of each set bit.  For example, the following will print
304cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project   the bits set in a bitset:
305cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project
306cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project   bitset_bindex i;
307cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project   bitset_iterator iter;
308cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project
309cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project   BITSET_FOR_EACH (iter, src, i, 0)
310cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project   {
311cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project      printf ("%lu ", (unsigned long int) i);
312cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project   };
313cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project*/
314cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project#define BITSET_FOR_EACH(ITER, BSET, INDEX, MIN)				      \
315cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project  for (ITER.next = (MIN), ITER.num = BITSET_LIST_SIZE;			      \
316cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project       (ITER.num == BITSET_LIST_SIZE)					      \
317cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project       && (ITER.num = bitset_list (BSET, ITER.list,			      \
318cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project				   BITSET_LIST_SIZE, &ITER.next));)	      \
319cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project    for (ITER.i = 0;							      \
320cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project	 ITER.i < ITER.num && ((INDEX) = ITER.list[ITER.i], 1);		      \
321cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project	 ITER.i++)
322cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project
323cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project
324cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project/* Loop over all elements of BSET, in reverse order starting with
325cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project   MIN, setting INDEX to the index of each set bit.  For example, the
326cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project   following will print the bits set in a bitset in reverse order:
327cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project
328cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project   bitset_bindex i;
329cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project   bitset_iterator iter;
330cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project
331cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project   BITSET_FOR_EACH_REVERSE (iter, src, i, 0)
332cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project   {
333cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project      printf ("%lu ", (unsigned long int) i);
334cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project   };
335cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project*/
336cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project#define BITSET_FOR_EACH_REVERSE(ITER, BSET, INDEX, MIN)			      \
337cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project  for (ITER.next = (MIN), ITER.num = BITSET_LIST_SIZE;			      \
338cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project       (ITER.num == BITSET_LIST_SIZE)					      \
339cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project       && (ITER.num = bitset_list_reverse (BSET, ITER.list,		      \
340cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project					   BITSET_LIST_SIZE, &ITER.next));)   \
341cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project    for (ITER.i = 0;							      \
342cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project	 ITER.i < ITER.num && ((INDEX) = ITER.list[ITER.i], 1);		      \
343cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project	 ITER.i++)
344cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project
345cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project
346cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project/* Define set operations in terms of logical operations.  */
347cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project
348cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project#define bitset_diff(DST, SRC1, SRC2) bitset_andn (DST, SRC1, SRC2)
349cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project#define bitset_diff_cmp(DST, SRC1, SRC2) bitset_andn_cmp (DST, SRC1, SRC2)
350cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project
351cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project#define bitset_intersection(DST, SRC1, SRC2) bitset_and (DST, SRC1, SRC2)
352cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project#define bitset_intersection_cmp(DST, SRC1, SRC2) bitset_and_cmp (DST, SRC1, SRC2)
353cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project
354cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project#define bitset_union(DST, SRC1, SRC2) bitset_or (DST, SRC1, SRC2)
355cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project#define bitset_union_cmp(DST, SRC1, SRC2) bitset_or_cmp (DST, SRC1, SRC2)
356cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project
357cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project/* Symmetrical difference.  */
358cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project#define bitset_symdiff(DST, SRC1, SRC2) bitset_xor (DST, SRC1, SRC2)
359cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project#define bitset_symdiff_cmp(DST, SRC1, SRC2) bitset_xor_cmp (DST, SRC1, SRC2)
360cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project
361cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project/* Union of difference.  */
362cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project#define bitset_diff_union(DST, SRC1, SRC2, SRC3) \
363cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project  bitset_andn_or (DST, SRC1, SRC2, SRC3)
364cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project#define bitset_diff_union_cmp(DST, SRC1, SRC2, SRC3) \
365cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project  bitset_andn_or_cmp (DST, SRC1, SRC2, SRC3)
366cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project
367cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project
368cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project/* Release any memory tied up with bitsets.  */
369cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Projectextern void bitset_release_memory (void);
370cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project
371cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project/* Enable bitset stats gathering.  */
372cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Projectextern void bitset_stats_enable (void);
373cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project
374cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project/* Disable bitset stats gathering.  */
375cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Projectextern void bitset_stats_disable (void);
376cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project
377cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project/* Read bitset stats file of accummulated stats.  */
378cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Projectvoid bitset_stats_read (const char *file_name);
379cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project
380cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project/* Write bitset stats file of accummulated stats.  */
381cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Projectvoid bitset_stats_write (const char *file_name);
382cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project
383cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project/* Dump bitset stats.  */
384cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Projectextern void bitset_stats_dump (FILE *);
385cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project
386cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project/* Function to debug bitset from debugger.  */
387cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Projectextern void debug_bitset (bitset);
388cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project
389cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project/* Function to debug bitset stats from debugger.  */
390cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Projectextern void debug_bitset_stats (void);
391cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project
392cea198a11f15a2eb071d98491ca9a8bc8cebfbc4The Android Open Source Project#endif /* _BITSET_H  */
393