1 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
2  * Copyright by The HDF Group.                                               *
3  * Copyright by the Board of Trustees of the University of Illinois.         *
4  * All rights reserved.                                                      *
5  *                                                                           *
6  * This file is part of HDF.  The full HDF copyright notice, including       *
7  * terms governing use, modification, and redistribution, is contained in    *
8  * the COPYING file, which can be found at the root of the source code       *
9  * distribution tree, or in https://support.hdfgroup.org/ftp/HDF/releases/.  *
10  * If you do not have access to either file, you may request a copy from     *
11  * help@hdfgroup.org.                                                        *
12  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
13 
14 /* $Id$ */
15 
16 /*-----------------------------------------------------------------------------
17  * File:    bitvect.h
18  * Purpose: header file for bit-vector API
19  * Dependencies:
20  * Invokes:
21  * Contents:
22  * Structure definitions:
23  * Constant definitions:
24  *---------------------------------------------------------------------------*/
25 
26 /* avoid re-inclusion */
27 #ifndef __BITVECT_H
28 #define __BITVECT_H
29 
30 #include "H4api_adpt.h"
31 
32 #include "hdf.h"
33 
34 /* Boolean values used */
35 typedef enum {BV_FALSE=0, BV_TRUE=1} bv_bool;
36 
37 /* Flags for the bit-vector */
38 #define BV_INIT_TO_ONE  0x00000001  /* to indicate whether to create the bit-vector with one's instead of zero's */
39 #define BV_EXTENDABLE   0x00000002  /* to indicate that the bit-vector can be extended */
40 
41 /* Default size of a bit-vector */
42 #define BV_DEFAULT_BITS 128
43 
44 /* Define the size of the chunks bits are allocated in */
45 #define BV_CHUNK_SIZE 64
46 
47 /* Create the external interface data structures needed */
48 typedef struct bv_struct_tag *bv_ptr;
49 
50 #if defined BV_MASTER | defined BV_TESTER
51 
52 /* Base type of the array used to store the bits */
53 typedef unsigned char bv_base;
54 
55 /* # of bits in the base type of the array used to store the bits */
56 #define BV_BASE_BITS    (sizeof(bv_base)*8)
57 
58 /* bit-vector structure used */
59 typedef struct bv_struct_tag {
60     uint32 bits_used;       /* The actual number of bits current in use */
61     uint32 array_size;      /* The number of bv_base elements in the bit-vector */
62     uint32 flags;           /* The flags used to create this bit-vector */
63     int32 last_zero;        /* The last location we know had a zero bit */
64     bv_base *buffer;        /* Pointer to the buffer used to store the bits */
65   }bv_struct;
66 
67 /* Table of bits for each bit position */
68 /*  (This will need to be changed/expanded if another base type is used) */
69 static const uint8 bv_bit_value[8]={
70     1,  /* bit 0's value is 1 */
71     2,  /* bit 1's value is 2 */
72     4,  /* bit 2's value is 4 */
73     8,  /* bit 3's value is 8 */
74     16,  /* bit 4's value is 16 */
75     32,  /* bit 5's value is 32 */
76     64,  /* bit 6's value is 64 */
77     128   /* bit 7's value is 128 */
78 };
79 
80 /* Table of bit-masks for each number of bits in a byte */
81 /*  (This will need to be changed/expanded if another base type is used) */
82 static const uint8 bv_bit_mask[9]={
83     0x00,  /* 0 bits is a mask of 0x00 */
84     0x01,  /* 1 bits is a mask of 0x01 */
85     0x03,  /* 2 bits is a mask of 0x03 */
86     0x07,  /* 3 bits is a mask of 0x07 */
87     0x0F,  /* 4 bits is a mask of 0x0F */
88     0x1F,  /* 5 bits is a mask of 0x1F */
89     0x3F,  /* 6 bits is a mask of 0x3F */
90     0x7F,  /* 7 bits is a mask of 0x7F */
91     0xFF   /* 8 bits is a mask of 0xFF */
92 };
93 
94 /* Table of "first zero bit" for each byte value */
95 /*  (This will need to be changed/expanded if another base type is used) */
96 static const int8 bv_first_zero[256]={
97     0,  /* "0" - bit 0 is lowest zero */ 1,  /* "1" - bit 1 is lowest zero */
98     0,  /* "2" - bit 0 is lowest zero */ 2,  /* "3" - bit 2 is lowest zero */
99     0,  /* "4" - bit 0 is lowest zero */ 1,  /* "5" - bit 1 is lowest zero */
100     0,  /* "6" - bit 0 is lowest zero */ 3,  /* "7" - bit 3 is lowest zero */
101     0,  /* "8" - bit 0 is lowest zero */ 1,  /* "9" - bit 1 is lowest zero */
102     0,  /* "10" - bit 0 is lowest zero */ 2,  /* "11" - bit 2 is lowest zero */
103     0,  /* "12" - bit 0 is lowest zero */ 1,  /* "13" - bit 1 is lowest zero */
104     0,  /* "14" - bit 0 is lowest zero */ 4,  /* "15" - bit 4 is lowest zero */
105     0,  /* "16" - bit 0 is lowest zero */ 1,  /* "17" - bit 1 is lowest zero */
106     0,  /* "18" - bit 0 is lowest zero */ 2,  /* "19" - bit 2 is lowest zero */
107     0,  /* "20" - bit 0 is lowest zero */ 1,  /* "21" - bit 1 is lowest zero */
108     0,  /* "22" - bit 0 is lowest zero */ 3,  /* "23" - bit 3 is lowest zero */
109     0,  /* "24" - bit 0 is lowest zero */ 1,  /* "25" - bit 1 is lowest zero */
110     0,  /* "26" - bit 0 is lowest zero */ 2,  /* "27" - bit 2 is lowest zero */
111     0,  /* "28" - bit 0 is lowest zero */ 1,  /* "29" - bit 1 is lowest zero */
112     0,  /* "30" - bit 0 is lowest zero */ 5,  /* "31" - bit 5 is lowest zero */
113     0,  /* "32" - bit 0 is lowest zero */ 1,  /* "33" - bit 1 is lowest zero */
114     0,  /* "34" - bit 0 is lowest zero */ 2,  /* "35" - bit 2 is lowest zero */
115     0,  /* "36" - bit 0 is lowest zero */ 1,  /* "37" - bit 1 is lowest zero */
116     0,  /* "38" - bit 0 is lowest zero */ 3,  /* "39" - bit 3 is lowest zero */
117     0,  /* "40" - bit 0 is lowest zero */ 1,  /* "41" - bit 1 is lowest zero */
118     0,  /* "42" - bit 0 is lowest zero */ 2,  /* "43" - bit 2 is lowest zero */
119     0,  /* "44" - bit 0 is lowest zero */ 1,  /* "45" - bit 1 is lowest zero */
120     0,  /* "46" - bit 0 is lowest zero */ 4,  /* "47" - bit 4 is lowest zero */
121     0,  /* "48" - bit 0 is lowest zero */ 1,  /* "49" - bit 1 is lowest zero */
122     0,  /* "50" - bit 0 is lowest zero */ 2,  /* "51" - bit 2 is lowest zero */
123     0,  /* "52" - bit 0 is lowest zero */ 1,  /* "53" - bit 1 is lowest zero */
124     0,  /* "54" - bit 0 is lowest zero */ 3,  /* "55" - bit 3 is lowest zero */
125     0,  /* "56" - bit 0 is lowest zero */ 1,  /* "57" - bit 1 is lowest zero */
126     0,  /* "58" - bit 0 is lowest zero */ 2,  /* "59" - bit 2 is lowest zero */
127     0,  /* "60" - bit 0 is lowest zero */ 1,  /* "61" - bit 1 is lowest zero */
128     0,  /* "62" - bit 0 is lowest zero */ 6,  /* "63" - bit 6 is lowest zero */
129     0,  /* "64" - bit 0 is lowest zero */ 1,  /* "65" - bit 1 is lowest zero */
130     0,  /* "66" - bit 0 is lowest zero */ 2,  /* "67" - bit 2 is lowest zero */
131     0,  /* "68" - bit 0 is lowest zero */ 1,  /* "69" - bit 1 is lowest zero */
132     0,  /* "70" - bit 0 is lowest zero */ 3,  /* "71" - bit 3 is lowest zero */
133     0,  /* "72" - bit 0 is lowest zero */ 1,  /* "73" - bit 1 is lowest zero */
134     0,  /* "74" - bit 0 is lowest zero */ 2,  /* "75" - bit 2 is lowest zero */
135     0,  /* "76" - bit 0 is lowest zero */ 1,  /* "77" - bit 1 is lowest zero */
136     0,  /* "78" - bit 0 is lowest zero */ 4,  /* "79" - bit 4 is lowest zero */
137     0,  /* "80" - bit 0 is lowest zero */ 1,  /* "81" - bit 1 is lowest zero */
138     0,  /* "82" - bit 0 is lowest zero */ 2,  /* "83" - bit 2 is lowest zero */
139     0,  /* "84" - bit 0 is lowest zero */ 1,  /* "85" - bit 1 is lowest zero */
140     0,  /* "86" - bit 0 is lowest zero */ 3,  /* "87" - bit 3 is lowest zero */
141     0,  /* "88" - bit 0 is lowest zero */ 1,  /* "89" - bit 1 is lowest zero */
142     0,  /* "90" - bit 0 is lowest zero */ 2,  /* "91" - bit 2 is lowest zero */
143     0,  /* "92" - bit 0 is lowest zero */ 1,  /* "93" - bit 1 is lowest zero */
144     0,  /* "94" - bit 0 is lowest zero */ 5,  /* "95" - bit 5 is lowest zero */
145     0,  /* "96" - bit 0 is lowest zero */ 1,  /* "97" - bit 1 is lowest zero */
146     0,  /* "98" - bit 0 is lowest zero */ 2,  /* "99" - bit 2 is lowest zero */
147     0,  /* "100" - bit 0 is lowest zero */ 1,  /* "101" - bit 1 is lowest zero */
148     0,  /* "102" - bit 0 is lowest zero */ 3,  /* "103" - bit 3 is lowest zero */
149     0,  /* "104" - bit 0 is lowest zero */ 1,  /* "105" - bit 1 is lowest zero */
150     0,  /* "106" - bit 0 is lowest zero */ 2,  /* "107" - bit 2 is lowest zero */
151     0,  /* "108" - bit 0 is lowest zero */ 1,  /* "109" - bit 1 is lowest zero */
152     0,  /* "110" - bit 0 is lowest zero */ 4,  /* "111" - bit 4 is lowest zero */
153     0,  /* "112" - bit 0 is lowest zero */ 1,  /* "113" - bit 1 is lowest zero */
154     0,  /* "114" - bit 0 is lowest zero */ 2,  /* "115" - bit 2 is lowest zero */
155     0,  /* "116" - bit 0 is lowest zero */ 1,  /* "117" - bit 1 is lowest zero */
156     0,  /* "118" - bit 0 is lowest zero */ 3,  /* "119" - bit 3 is lowest zero */
157     0,  /* "120" - bit 0 is lowest zero */ 1,  /* "121" - bit 1 is lowest zero */
158     0,  /* "122" - bit 0 is lowest zero */ 2,  /* "123" - bit 2 is lowest zero */
159     0,  /* "124" - bit 0 is lowest zero */ 1,  /* "125" - bit 1 is lowest zero */
160     0,  /* "126" - bit 0 is lowest zero */ 7,  /* "127" - bit 7 is lowest zero */
161     0,  /* "128" - bit 0 is lowest zero */ 1,  /* "129" - bit 1 is lowest zero */
162     0,  /* "130" - bit 0 is lowest zero */ 2,  /* "131" - bit 2 is lowest zero */
163     0,  /* "132" - bit 0 is lowest zero */ 1,  /* "133" - bit 1 is lowest zero */
164     0,  /* "134" - bit 0 is lowest zero */ 3,  /* "135" - bit 3 is lowest zero */
165     0,  /* "136" - bit 0 is lowest zero */ 1,  /* "137" - bit 1 is lowest zero */
166     0,  /* "138" - bit 0 is lowest zero */ 2,  /* "139" - bit 2 is lowest zero */
167     0,  /* "140" - bit 0 is lowest zero */ 1,  /* "141" - bit 1 is lowest zero */
168     0,  /* "142" - bit 0 is lowest zero */ 4,  /* "143" - bit 4 is lowest zero */
169     0,  /* "144" - bit 0 is lowest zero */ 1,  /* "145" - bit 1 is lowest zero */
170     0,  /* "146" - bit 0 is lowest zero */ 2,  /* "147" - bit 2 is lowest zero */
171     0,  /* "148" - bit 0 is lowest zero */ 1,  /* "149" - bit 1 is lowest zero */
172     0,  /* "150" - bit 0 is lowest zero */ 3,  /* "151" - bit 3 is lowest zero */
173     0,  /* "152" - bit 0 is lowest zero */ 1,  /* "153" - bit 1 is lowest zero */
174     0,  /* "154" - bit 0 is lowest zero */ 2,  /* "155" - bit 2 is lowest zero */
175     0,  /* "156" - bit 0 is lowest zero */ 1,  /* "157" - bit 1 is lowest zero */
176     0,  /* "158" - bit 0 is lowest zero */ 5,  /* "159" - bit 5 is lowest zero */
177     0,  /* "160" - bit 0 is lowest zero */ 1,  /* "161" - bit 1 is lowest zero */
178     0,  /* "162" - bit 0 is lowest zero */ 2,  /* "163" - bit 2 is lowest zero */
179     0,  /* "164" - bit 0 is lowest zero */ 1,  /* "165" - bit 1 is lowest zero */
180     0,  /* "166" - bit 0 is lowest zero */ 3,  /* "167" - bit 3 is lowest zero */
181     0,  /* "168" - bit 0 is lowest zero */ 1,  /* "169" - bit 1 is lowest zero */
182     0,  /* "170" - bit 0 is lowest zero */ 2,  /* "171" - bit 2 is lowest zero */
183     0,  /* "172" - bit 0 is lowest zero */ 1,  /* "173" - bit 1 is lowest zero */
184     0,  /* "174" - bit 0 is lowest zero */ 4,  /* "175" - bit 4 is lowest zero */
185     0,  /* "176" - bit 0 is lowest zero */ 1,  /* "177" - bit 1 is lowest zero */
186     0,  /* "178" - bit 0 is lowest zero */ 2,  /* "179" - bit 2 is lowest zero */
187     0,  /* "180" - bit 0 is lowest zero */ 1,  /* "181" - bit 1 is lowest zero */
188     0,  /* "182" - bit 0 is lowest zero */ 3,  /* "183" - bit 3 is lowest zero */
189     0,  /* "184" - bit 0 is lowest zero */ 1,  /* "185" - bit 1 is lowest zero */
190     0,  /* "186" - bit 0 is lowest zero */ 2,  /* "187" - bit 2 is lowest zero */
191     0,  /* "188" - bit 0 is lowest zero */ 1,  /* "189" - bit 1 is lowest zero */
192     0,  /* "190" - bit 0 is lowest zero */ 6,  /* "191" - bit 6 is lowest zero */
193     0,  /* "192" - bit 0 is lowest zero */ 1,  /* "193" - bit 1 is lowest zero */
194     0,  /* "194" - bit 0 is lowest zero */ 2,  /* "195" - bit 2 is lowest zero */
195     0,  /* "196" - bit 0 is lowest zero */ 1,  /* "197" - bit 1 is lowest zero */
196     0,  /* "198" - bit 0 is lowest zero */ 3,  /* "199" - bit 3 is lowest zero */
197     0,  /* "200" - bit 0 is lowest zero */ 1,  /* "201" - bit 1 is lowest zero */
198     0,  /* "202" - bit 0 is lowest zero */ 2,  /* "203" - bit 2 is lowest zero */
199     0,  /* "204" - bit 0 is lowest zero */ 1,  /* "205" - bit 1 is lowest zero */
200     0,  /* "206" - bit 0 is lowest zero */ 4,  /* "207" - bit 4 is lowest zero */
201     0,  /* "208" - bit 0 is lowest zero */ 1,  /* "209" - bit 1 is lowest zero */
202     0,  /* "210" - bit 0 is lowest zero */ 2,  /* "211" - bit 2 is lowest zero */
203     0,  /* "212" - bit 0 is lowest zero */ 1,  /* "213" - bit 1 is lowest zero */
204     0,  /* "214" - bit 0 is lowest zero */ 3,  /* "215" - bit 3 is lowest zero */
205     0,  /* "216" - bit 0 is lowest zero */ 1,  /* "217" - bit 1 is lowest zero */
206     0,  /* "218" - bit 0 is lowest zero */ 2,  /* "219" - bit 2 is lowest zero */
207     0,  /* "220" - bit 0 is lowest zero */ 1,  /* "221" - bit 1 is lowest zero */
208     0,  /* "222" - bit 0 is lowest zero */ 5,  /* "223" - bit 5 is lowest zero */
209     0,  /* "224" - bit 0 is lowest zero */ 1,  /* "225" - bit 1 is lowest zero */
210     0,  /* "226" - bit 0 is lowest zero */ 2,  /* "227" - bit 2 is lowest zero */
211     0,  /* "228" - bit 0 is lowest zero */ 1,  /* "229" - bit 1 is lowest zero */
212     0,  /* "230" - bit 0 is lowest zero */ 3,  /* "231" - bit 3 is lowest zero */
213     0,  /* "232" - bit 0 is lowest zero */ 1,  /* "233" - bit 1 is lowest zero */
214     0,  /* "234" - bit 0 is lowest zero */ 2,  /* "235" - bit 2 is lowest zero */
215     0,  /* "236" - bit 0 is lowest zero */ 1,  /* "237" - bit 1 is lowest zero */
216     0,  /* "238" - bit 0 is lowest zero */ 4,  /* "239" - bit 4 is lowest zero */
217     0,  /* "240" - bit 0 is lowest zero */ 1,  /* "241" - bit 1 is lowest zero */
218     0,  /* "242" - bit 0 is lowest zero */ 2,  /* "243" - bit 2 is lowest zero */
219     0,  /* "244" - bit 0 is lowest zero */ 1,  /* "245" - bit 1 is lowest zero */
220     0,  /* "246" - bit 0 is lowest zero */ 3,  /* "247" - bit 3 is lowest zero */
221     0,  /* "248" - bit 0 is lowest zero */ 1,  /* "249" - bit 1 is lowest zero */
222     0,  /* "250" - bit 0 is lowest zero */ 2,  /* "251" - bit 2 is lowest zero */
223     0,  /* "252" - bit 0 is lowest zero */ 1,  /* "253" - bit 1 is lowest zero */
224     0,  /* "254" - bit 0 is lowest zero */ 8   /* "255" - bit 8 is lowest zero */
225 };
226 
227 /* Table of "number of 1 bits" for each byte value */
228 /*  (This will need to be changed/expanded if another base type is used) */
229 static const int8 bv_num_ones[256]={
230     0,  /* "0" - n bits are 1's */ 1,  /* "1" - n bits are 1's */
231     1,  /* "2" - n bits are 1's */ 2,  /* "3" - n bits are 1's */
232     1,  /* "4" - n bits are 1's */ 2,  /* "5" - n bits are 1's */
233     2,  /* "6" - n bits are 1's */ 3,  /* "7" - n bits are 1's */
234     1,  /* "8" - n bits are 1's */ 2,  /* "9" - n bits are 1's */
235     2,  /* "10" - n bits are 1's */ 3,  /* "11" - n bits are 1's */
236     2,  /* "12" - n bits are 1's */ 3,  /* "13" - n bits are 1's */
237     3,  /* "14" - n bits are 1's */ 4,  /* "15" - n bits are 1's */
238     1,  /* "16" - n bits are 1's */ 2,  /* "17" - n bits are 1's */
239     2,  /* "18" - n bits are 1's */ 3,  /* "19" - n bits are 1's */
240     2,  /* "20" - n bits are 1's */ 3,  /* "21" - n bits are 1's */
241     3,  /* "22" - n bits are 1's */ 4,  /* "23" - n bits are 1's */
242     2,  /* "24" - n bits are 1's */ 3,  /* "25" - n bits are 1's */
243     3,  /* "26" - n bits are 1's */ 4,  /* "27" - n bits are 1's */
244     3,  /* "28" - n bits are 1's */ 3,  /* "29" - n bits are 1's */
245     4,  /* "30" - n bits are 1's */ 5,  /* "31" - n bits are 1's */
246     1,  /* "32" - n bits are 1's */ 2,  /* "33" - n bits are 1's */
247     2,  /* "34" - n bits are 1's */ 3,  /* "35" - n bits are 1's */
248     2,  /* "36" - n bits are 1's */ 3,  /* "37" - n bits are 1's */
249     3,  /* "38" - n bits are 1's */ 4,  /* "39" - n bits are 1's */
250     2,  /* "40" - n bits are 1's */ 3,  /* "41" - n bits are 1's */
251     3,  /* "42" - n bits are 1's */ 4,  /* "43" - n bits are 1's */
252     3,  /* "44" - n bits are 1's */ 4,  /* "45" - n bits are 1's */
253     4,  /* "46" - n bits are 1's */ 5,  /* "47" - n bits are 1's */
254     2,  /* "48" - n bits are 1's */ 3,  /* "49" - n bits are 1's */
255     3,  /* "50" - n bits are 1's */ 4,  /* "51" - n bits are 1's */
256     3,  /* "52" - n bits are 1's */ 4,  /* "53" - n bits are 1's */
257     4,  /* "54" - n bits are 1's */ 5,  /* "55" - n bits are 1's */
258     3,  /* "56" - n bits are 1's */ 4,  /* "57" - n bits are 1's */
259     4,  /* "58" - n bits are 1's */ 5,  /* "59" - n bits are 1's */
260     4,  /* "60" - n bits are 1's */ 5,  /* "61" - n bits are 1's */
261     5,  /* "62" - n bits are 1's */ 6,  /* "63" - n bits are 1's */
262     1,  /* "64" - n bits are 1's */ 2,  /* "65" - n bits are 1's */
263     2,  /* "66" - n bits are 1's */ 3,  /* "67" - n bits are 1's */
264     2,  /* "68" - n bits are 1's */ 3,  /* "69" - n bits are 1's */
265     3,  /* "70" - n bits are 1's */ 4,  /* "71" - n bits are 1's */
266     2,  /* "72" - n bits are 1's */ 3,  /* "73" - n bits are 1's */
267     3,  /* "74" - n bits are 1's */ 4,  /* "75" - n bits are 1's */
268     3,  /* "76" - n bits are 1's */ 4,  /* "77" - n bits are 1's */
269     4,  /* "78" - n bits are 1's */ 5,  /* "79" - n bits are 1's */
270     2,  /* "80" - n bits are 1's */ 3,  /* "81" - n bits are 1's */
271     3,  /* "82" - n bits are 1's */ 4,  /* "83" - n bits are 1's */
272     3,  /* "84" - n bits are 1's */ 4,  /* "85" - n bits are 1's */
273     4,  /* "86" - n bits are 1's */ 5,  /* "87" - n bits are 1's */
274     3,  /* "88" - n bits are 1's */ 4,  /* "89" - n bits are 1's */
275     4,  /* "90" - n bits are 1's */ 5,  /* "91" - n bits are 1's */
276     4,  /* "92" - n bits are 1's */ 5,  /* "93" - n bits are 1's */
277     5,  /* "94" - n bits are 1's */ 6,  /* "95" - n bits are 1's */
278     2,  /* "96" - n bits are 1's */ 3,  /* "97" - n bits are 1's */
279     3,  /* "98" - n bits are 1's */ 4,  /* "99" - n bits are 1's */
280     3,  /* "100" - n bits are 1's */ 4,  /* "101" - n bits are 1's */
281     4,  /* "102" - n bits are 1's */ 5,  /* "103" - n bits are 1's */
282     3,  /* "104" - n bits are 1's */ 4,  /* "105" - n bits are 1's */
283     4,  /* "106" - n bits are 1's */ 5,  /* "107" - n bits are 1's */
284     3,  /* "108" - n bits are 1's */ 4,  /* "109" - n bits are 1's */
285     4,  /* "110" - n bits are 1's */ 5,  /* "111" - n bits are 1's */
286     3,  /* "112" - n bits are 1's */ 4,  /* "113" - n bits are 1's */
287     4,  /* "114" - n bits are 1's */ 5,  /* "115" - n bits are 1's */
288     4,  /* "116" - n bits are 1's */ 5,  /* "117" - n bits are 1's */
289     5,  /* "118" - n bits are 1's */ 6,  /* "119" - n bits are 1's */
290     4,  /* "120" - n bits are 1's */ 5,  /* "121" - n bits are 1's */
291     5,  /* "122" - n bits are 1's */ 6,  /* "123" - n bits are 1's */
292     5,  /* "124" - n bits are 1's */ 6,  /* "125" - n bits are 1's */
293     6,  /* "126" - n bits are 1's */ 7,  /* "127" - n bits are 1's */
294     1,  /* "128" - n bits are 1's */ 2,  /* "129" - n bits are 1's */
295     2,  /* "130" - n bits are 1's */ 3,  /* "131" - n bits are 1's */
296     2,  /* "132" - n bits are 1's */ 3,  /* "133" - n bits are 1's */
297     3,  /* "134" - n bits are 1's */ 4,  /* "135" - n bits are 1's */
298     2,  /* "136" - n bits are 1's */ 3,  /* "137" - n bits are 1's */
299     3,  /* "138" - n bits are 1's */ 4,  /* "139" - n bits are 1's */
300     3,  /* "140" - n bits are 1's */ 4,  /* "141" - n bits are 1's */
301     4,  /* "142" - n bits are 1's */ 5,  /* "143" - n bits are 1's */
302     2,  /* "144" - n bits are 1's */ 3,  /* "145" - n bits are 1's */
303     3,  /* "146" - n bits are 1's */ 4,  /* "147" - n bits are 1's */
304     3,  /* "148" - n bits are 1's */ 4,  /* "149" - n bits are 1's */
305     4,  /* "150" - n bits are 1's */ 5,  /* "151" - n bits are 1's */
306     3,  /* "152" - n bits are 1's */ 4,  /* "153" - n bits are 1's */
307     4,  /* "154" - n bits are 1's */ 5,  /* "155" - n bits are 1's */
308     4,  /* "156" - n bits are 1's */ 5,  /* "157" - n bits are 1's */
309     5,  /* "158" - n bits are 1's */ 6,  /* "159" - n bits are 1's */
310     2,  /* "160" - n bits are 1's */ 3,  /* "161" - n bits are 1's */
311     3,  /* "162" - n bits are 1's */ 4,  /* "163" - n bits are 1's */
312     3,  /* "164" - n bits are 1's */ 4,  /* "165" - n bits are 1's */
313     4,  /* "166" - n bits are 1's */ 5,  /* "167" - n bits are 1's */
314     3,  /* "168" - n bits are 1's */ 4,  /* "169" - n bits are 1's */
315     4,  /* "170" - n bits are 1's */ 5,  /* "171" - n bits are 1's */
316     4,  /* "172" - n bits are 1's */ 5,  /* "173" - n bits are 1's */
317     5,  /* "174" - n bits are 1's */ 6,  /* "175" - n bits are 1's */
318     3,  /* "176" - n bits are 1's */ 4,  /* "177" - n bits are 1's */
319     4,  /* "178" - n bits are 1's */ 5,  /* "179" - n bits are 1's */
320     4,  /* "180" - n bits are 1's */ 5,  /* "181" - n bits are 1's */
321     5,  /* "182" - n bits are 1's */ 6,  /* "183" - n bits are 1's */
322     4,  /* "184" - n bits are 1's */ 5,  /* "185" - n bits are 1's */
323     5,  /* "186" - n bits are 1's */ 6,  /* "187" - n bits are 1's */
324     5,  /* "188" - n bits are 1's */ 6,  /* "189" - n bits are 1's */
325     6,  /* "190" - n bits are 1's */ 7,  /* "191" - n bits are 1's */
326     2,  /* "192" - n bits are 1's */ 3,  /* "193" - n bits are 1's */
327     3,  /* "194" - n bits are 1's */ 4,  /* "195" - n bits are 1's */
328     3,  /* "196" - n bits are 1's */ 4,  /* "197" - n bits are 1's */
329     4,  /* "198" - n bits are 1's */ 5,  /* "199" - n bits are 1's */
330     3,  /* "200" - n bits are 1's */ 4,  /* "201" - n bits are 1's */
331     4,  /* "202" - n bits are 1's */ 5,  /* "203" - n bits are 1's */
332     4,  /* "204" - n bits are 1's */ 5,  /* "205" - n bits are 1's */
333     5,  /* "206" - n bits are 1's */ 6,  /* "207" - n bits are 1's */
334     3,  /* "208" - n bits are 1's */ 4,  /* "209" - n bits are 1's */
335     4,  /* "210" - n bits are 1's */ 5,  /* "211" - n bits are 1's */
336     4,  /* "212" - n bits are 1's */ 5,  /* "213" - n bits are 1's */
337     5,  /* "214" - n bits are 1's */ 6,  /* "215" - n bits are 1's */
338     4,  /* "216" - n bits are 1's */ 5,  /* "217" - n bits are 1's */
339     5,  /* "218" - n bits are 1's */ 6,  /* "219" - n bits are 1's */
340     5,  /* "220" - n bits are 1's */ 6,  /* "221" - n bits are 1's */
341     6,  /* "222" - n bits are 1's */ 7,  /* "223" - n bits are 1's */
342     3,  /* "224" - n bits are 1's */ 4,  /* "225" - n bits are 1's */
343     4,  /* "226" - n bits are 1's */ 5,  /* "227" - n bits are 1's */
344     4,  /* "228" - n bits are 1's */ 5,  /* "229" - n bits are 1's */
345     5,  /* "230" - n bits are 1's */ 6,  /* "231" - n bits are 1's */
346     4,  /* "232" - n bits are 1's */ 5,  /* "233" - n bits are 1's */
347     5,  /* "234" - n bits are 1's */ 6,  /* "235" - n bits are 1's */
348     5,  /* "236" - n bits are 1's */ 6,  /* "237" - n bits are 1's */
349     6,  /* "238" - n bits are 1's */ 7,  /* "239" - n bits are 1's */
350     4,  /* "240" - n bits are 1's */ 5,  /* "241" - n bits are 1's */
351     5,  /* "242" - n bits are 1's */ 6,  /* "243" - n bits are 1's */
352     5,  /* "244" - n bits are 1's */ 6,  /* "245" - n bits are 1's */
353     6,  /* "246" - n bits are 1's */ 7,  /* "247" - n bits are 1's */
354     5,  /* "248" - n bits are 1's */ 6,  /* "249" - n bits are 1's */
355     6,  /* "250" - n bits are 1's */ 7,  /* "251" - n bits are 1's */
356     6,  /* "252" - n bits are 1's */ 7,  /* "253" - n bits are 1's */
357     7,  /* "254" - n bits are 1's */ 8   /* "255" - n bits are 1's */
358 };
359 
360 /* Useful routines for generally private use */
361 
362 #endif /* BV_MASTER | BV_TESTER */
363 #if defined c_plusplus || defined __cplusplus
364 extern      "C"
365 {
366 #endif                          /* c_plusplus || __cplusplus */
367 HDFLIBAPI bv_ptr bv_new(int32 num_bits, uint32 flags);
368 
369 HDFLIBAPI intn bv_delete(bv_ptr b);
370 
371 HDFLIBAPI intn bv_set(bv_ptr b, int32 bit_num, bv_bool value);
372 
373 HDFLIBAPI intn bv_get(bv_ptr b, int32 bit_num);
374 
375 HDFLIBAPI intn bv_clear(bv_ptr b, bv_bool value);
376 
377 HDFLIBAPI int32 bv_size(bv_ptr b);
378 
379 HDFLIBAPI uint32 bv_flags(bv_ptr b);
380 
381 HDFLIBAPI int32 bv_find(bv_ptr b, int32 last_find, bv_bool value);
382 
383 #if defined c_plusplus || defined __cplusplus
384 }
385 #endif                          /* c_plusplus || __cplusplus */
386 
387 #endif /* __BITVECT_H */
388 
389