File: bitOut.h

package info (click to toggle)
vic 2.8ucl4-2
  • links: PTS
  • area: main
  • in suites: potato
  • size: 5,864 kB
  • ctags: 9,033
  • sloc: ansic: 56,989; cpp: 44,560; tcl: 5,550; sh: 1,382; perl: 1,329; makefile: 357
file content (96 lines) | stat: -rw-r--r-- 2,880 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
/***********************************************************HeaderBegin*******
 *                                                                         
 * File:        bitio.h
 *
 * Author:      T.W. M.F.
 * Created:     23-July-96 
 *                                                                         
 * Description: Routines for buffering and bit-io
 *
 * Notes: 
 *
 * Modified:  
 *
 ***********************************************************HeaderEnd*********/

#ifndef _BITIO_H
#define _BITIO_H

#include <stdio.h>



/***********************************************************CommentBegin******
 *
 * -- Bitstr -- Bitstream Type
 *
 * Author:       T.W.
 *
 * Created:      23-July-96
 *
 * Description:  int    size          buffer size in bit
 *               int    ind           indicator; number of bits in buffer
 *               int    actualSize    actual size of the buffer (read in)
 *               Byte   *b            pointer to buffer
 *               FILE   *fp           pointer to file
 *
 * Note:         -
 *
 * See also:     -
 *
 * Modified:     13-Aug-96 K.S.
 *
 *****************************************************************************/
typedef struct{
  int   size;
  int   ind;
  int   actualSize;
  Byte  *b;
  FILE  *fp;
} Bitstr;
/***********************************************************CommentEnd********/
 
/***********************************************************CommentBegin******
 *
 * -- READBIT -- Macro: extracts bit
 *
 * Arguments in:   x, l
 *
 * Return values:  bit number l (starting from MSB) out of x
 *****************************************************************************/
#define READBIT(x,l)          (unsigned long) (((x) & (1UL << (l))) ? 1 : 0)
/***********************************************************CommentEnd********/

/***********************************************************CommentBegin******
 *
 * -- SETBIT -- Macro: set bit number l to 1 in y
 *
 * Arguments in:    y, l
 *
 * Return values:
 *****************************************************************************/
#define SETBIT(y,l)           ((y) |= (1UL << (l)))
/***********************************************************CommentEnd********/

/***********************************************************CommentBegin******
 *
 * -- UNSETBIT -- Macro: set bit number l to 0 in y
 *
 * Arguments in:    y, l
 *
 * Return values:
 *****************************************************************************/
#define UNSETBIT(y,l)         ((y) &= (~(1UL << (l))))
/***********************************************************CommentEnd********/


        /*-------------------------------------*
        |       #defines
        \--------------------------------------*/
#define BUFFER_BLOCK_SIZE 512    /* Stepsize for reallocation of buffer */


/* Include prototype file */
#include "bitOut.p"

#endif /* _BITIO_H  */