wavelength 1.0.0
Loading...
Searching...
No Matches
BitStream Class Reference

Packer of values into a buffer bit by bit, lowest bit first. More...

#include <bitstream.h>

Public Member Functions

 BitStream (void *pBuffer, int nSize)
 Construct a stream over a buffer, positioned at the first bit.
void PackBool (int nValue)
 Append one bit, the lowest bit of a flag word.
void Pack (unsigned int nValue, int nBits)
 Append the low bits of a value.
void PackSigned (int nValue, int nBits)
 Append the low bits of a signed value in two's complement.
bool UnpackBool ()
 Read the next bit.
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.
unsigned int GetBitPos () const

Detailed Description

Packer of values into a buffer bit by bit, lowest bit first.

The class is not polymorphic and has no RTTI. The name is inferred. The packets of an online session pack their fields with it before they write the buffer to a BinStream.

Constructor & Destructor Documentation

◆ BitStream()

BitStream::BitStream ( void * pBuffer,
int nSize )

Construct a stream over a buffer, positioned at the first bit.

Parameters
pBufferThe buffer, which the caller retains.
nSizeThe buffer size in bytes.
Ghidra address:
NTSC-U/C: 0x00296e78
Ghidra address:
PAL: 0x002a0a88

Member Function Documentation

◆ PackBool()

void BitStream::PackBool ( int nValue)

Append one bit, the lowest bit of a flag word.

Parameters
nValueThe flag word. Only its lowest bit is appended.
Ghidra address:
NTSC-U/C: 0x00296e90
Ghidra address:
PAL: 0x002a0aa0

◆ Pack()

void BitStream::Pack ( unsigned int nValue,
int nBits )

Append the low bits of a value.

The first bit appended to an empty stream clears the whole buffer.

Parameters
nValueThe value.
nBitsThe number of bits to append.
Ghidra address:
NTSC-U/C: 0x00296ed0
Ghidra address:
PAL: 0x002a0ae0

◆ PackSigned()

void BitStream::PackSigned ( int nValue,
int nBits )

Append the low bits of a signed value in two's complement.

Parameters
nValueThe value.
nBitsThe number of bits to append.
Ghidra address:
NTSC-U/C: 0x00296eb0
Ghidra address:
PAL: 0x002a0ac0

◆ UnpackBool()

bool BitStream::UnpackBool ( )

Read the next bit.

Returns
The bit.
Ghidra address:
NTSC-U/C: 0x00296f90
Ghidra address:
PAL: 0x002a0ba0

◆ Unpack()

unsigned int BitStream::Unpack ( int nBits)

Read the next bits as an unsigned value.

Parameters
nBitsThe number of bits to read.
Returns
The value.
Ghidra address:
NTSC-U/C: 0x00296ff8
Ghidra address:
PAL: 0x002a0c08

◆ UnpackSigned()

int BitStream::UnpackSigned ( int nBits)

Read the next bits as a signed value in two's complement.

Parameters
nBitsThe number of bits to read.
Returns
The value.
Ghidra address:
NTSC-U/C: 0x00296fb0
Ghidra address:
PAL: 0x002a0bc0

◆ GetBitPos()

unsigned int BitStream::GetBitPos ( ) const
inline
Returns
The position of the next bit.

The documentation for this class was generated from the following file: