wavelength 1.0.0
Loading...
Searching...
No Matches
bitstream.h
Go to the documentation of this file.
1#pragma once
2
9class BitStream {
10public:
19 BitStream(void *pBuffer, int nSize);
20
28 void PackBool(int nValue);
29
40 void Pack(unsigned int nValue, int nBits);
41
50 void PackSigned(int nValue, int nBits);
51
59 bool UnpackBool();
60
69 unsigned int Unpack(int nBits);
70
79 int UnpackSigned(int nBits);
80
82 unsigned int GetBitPos() const {
83 return mBitPos;
84 }
85
86private:
95 void Write(unsigned int nValue, unsigned int nBits);
96
97 unsigned char *mBuffer;
98 unsigned int mBitPos;
99 int mSize;
100};
void PackSigned(int nValue, int nBits)
Append the low bits of a signed value in two's complement.
BitStream(void *pBuffer, int nSize)
Construct a stream over a buffer, positioned at the first bit.
void Pack(unsigned int nValue, int nBits)
Append the low bits of a value.
unsigned int GetBitPos() const
Definition bitstream.h:82
bool UnpackBool()
Read the next bit.
void PackBool(int nValue)
Append one bit, the lowest bit of a flag word.
unsigned int Unpack(int nBits)
Read the next bits as an unsigned value.
int UnpackSigned(int nBits)
Read the next bits as a signed value in two's complement.