blob: ca237d473f9d8a0ae4ab2c207315aa2707441285 (
plain) (
blame)
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
|
// Write bits into a bit stream. See BitStream for reading.
#ifndef BITWRITER_HH
#define BITWRITER_HH
#include <stddef.h>
class Pipeline;
class BitWriter
{
public:
// Write bits to the pipeline. It is the caller's responsibility
// to eventually call finish on the pipeline.
BitWriter(Pipeline* pl);
void writeBits(unsigned long long val, size_t bits);
void writeBitsSigned(long long val, size_t bits);
void writeBitsInt(int val, size_t bits);
// Force any partial byte to be written to the pipeline.
void flush();
private:
Pipeline* pl;
unsigned char ch;
size_t bit_offset;
};
#endif // BITWRITER_HH
|