MISR Toolkit  1.5.1
hbitio.h
Go to the documentation of this file.
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 files COPYING and Copyright.html. COPYING can be found at the root *
9  * of the source code distribution tree; Copyright.html can be found at *
10  * http://hdfgroup.org/products/hdf4/doc/Copyright.html. If you do not have *
11  * access to either file, you may request a copy from help@hdfgroup.org. *
12  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
13 
14 /* $Id: hbitio.h 4932 2007-09-07 17:17:23Z bmribler $ */
15 
16 /*
17  ** hbitio.h
18  **
19  ** Data structures and macros for bitfile access to HDF data objects.
20  ** These are mainly used for compression I/O and N-bit data objects.
21  */
22 
23 #ifndef __HBITIO_H
24 #define __HBITIO_H
25 
26 /* Define the number of elements in the buffered array */
27 #define BITBUF_SIZE 4096
28 /* Macro to define the number of bits cached in the 'bits' variable */
29 #define BITNUM (sizeof(uint8)*8)
30 /* Macro to define the number of bits able to be read/written at a time */
31 #define DATANUM (sizeof(uint32)*8)
32 
33 typedef struct bitrec_t
34  {
35  int32 acc_id; /* Access ID for H layer I/O routines */
36  int32 bit_id; /* Bitfile ID for internal use */
37  /* Note that since HDF has signed 32bit offset limit we need to change this to signed
38  since the get passed to Hxxx calls which take signed 32bit arguments */
39  int32 block_offset, /* offset of the current buffered block in the dataset */
40  max_offset, /* offset of the last byte written to the dataset */
41  byte_offset; /* offset of the current byte in the dataset */
42 
43  intn count, /* bit count to next boundary */
44  buf_read; /* number of bytes read into buffer (necessary for random I/O) */
45  uint8 access; /* What the access on this file is ('r', 'w', etc..) */
46  uint8 mode; /* how are we interacting with the data now ('r', 'w', etc) */
47  uint8 bits; /* extra bit buffer, 0..BITNUM-1 bits */
48  uint8 *bytep; /* current position in buffer */
49  uint8 *bytez; /* end of buffer to compare */
50  uint8 *bytea; /* byte buffer */
51  }
52 bitrec_t;
53 
54 #ifndef BITMASTER
55 extern
56 #endif
57 const uint8 maskc[9]
58 #ifdef BITMASTER
59 =
60 {0, 1, 3, 7, 15, 31, 63, 127, 255}
61 #endif
62  ;
63 
64 #ifndef BITMASTER
65 extern
66 #endif
67 const uint32 maskl[33]
68 #ifdef BITMASTER
69 =
70 {0x00000000,
71  0x00000001, 0x00000003, 0x00000007, 0x0000000f,
72  0x0000001f, 0x0000003f, 0x0000007f, 0x000000ff,
73  0x000001ff, 0x000003ff, 0x000007ff, 0x00000fff,
74  0x00001fff, 0x00003fff, 0x00007fff, 0x0000ffff,
75  0x0001ffff, 0x0003ffff, 0x0007ffff, 0x000fffff,
76  0x001fffff, 0x003fffff, 0x007fffff, 0x00ffffff,
77  0x01ffffff, 0x03ffffff, 0x07ffffff, 0x0fffffff,
78  0x1fffffff, 0x3fffffff, 0x7fffffff, 0xffffffffUL}
79 #endif
80  ;
81 
82 /* Function-like Macros */
83 #define Hputbit(bitid,bit) ((Hbitwrite(bitid,1,(uint32)bit)==FAIL) ? FAIL : SUCCEED)
84 
85 #endif /* __HBITIO_H */
uint8 * bytep
Definition: hbitio.h:48
const uint32 maskl[33]
intn buf_read
Definition: hbitio.h:43
uint8 * bytez
Definition: hbitio.h:49
const uint8 maskc[9]
int32 block_offset
Definition: hbitio.h:39
int32 byte_offset
Definition: hbitio.h:39
int32 max_offset
Definition: hbitio.h:39
struct bitrec_t bitrec_t
uint8 mode
Definition: hbitio.h:46
uint8 bits
Definition: hbitio.h:47
int32 bit_id
Definition: hbitio.h:36
uint8 * bytea
Definition: hbitio.h:50
uint8 access
Definition: hbitio.h:45
int32 acc_id
Definition: hbitio.h:35
intn count
Definition: hbitio.h:43

MISR Toolkit - Copyright © 2005 - 2020 Jet Propulsion Laboratory
Generated on Fri Jun 19 2020 22:49:52