resonance 1.0.1
Loading...
Searching...
No Matches
HxVarLenNumber Class Reference

Variable-length quantity, seven bits per byte, most significant group first. More...

#include <hxvarlennumber.h>

Public Member Functions

 HxVarLenNumber ()
 Construct with the quantity unset, for Read() to fill.
 HxVarLenNumber (int nValue)
 Store a quantity for Write().
 operator int () const
 Report the quantity.
HxStream & Write (HxStream &stream) const
 Write the quantity.
HxStream & Read (HxStream &stream)
 Read a quantity.

Public Attributes

int mValue

Detailed Description

Variable-length quantity, seven bits per byte, most significant group first.

The encoding is the one Standard MIDI Files use. Mid::Reader reads delta times and meta lengths through it, and the two string readers in HxStream's translation unit read their length prefixes through it. The object is the one word below. A routine of the class takes the word's address in a0. Its name comes from the debugging symbols of the North American demo release.

Constructor & Destructor Documentation

◆ HxVarLenNumber() [1/2]

HxVarLenNumber::HxVarLenNumber ( )
inline

Construct with the quantity unset, for Read() to fill.

◆ HxVarLenNumber() [2/2]

HxVarLenNumber::HxVarLenNumber ( int nValue)
inlineexplicit

Store a quantity for Write().

Parameters
nValueThe quantity.

Member Function Documentation

◆ operator int()

HxVarLenNumber::operator int ( ) const
inline

Report the quantity.

Returns
The quantity.

◆ Write()

HxStream & HxVarLenNumber::Write ( HxStream & stream) const

Write the quantity.

The groups are packed into one word, lowest group in the lowest byte and every higher group marked with the continuation bit, and the word's bytes are written lowest first through HxStream::WriteNum(). The value is shifted arithmetically. A negative value therefore never terminates. The shipped program does not call it.

Parameters
streamThe stream to write to.
Returns
The stream.
Ghidra address:
NTSC-U/C: 0x00405ad8
Ghidra address:
PAL: 0x0043f3c8

◆ Read()

HxStream & HxVarLenNumber::Read ( HxStream & stream)

Read a quantity.

The value is cleared and each byte read through HxStream::ReadNum() adds its low seven bits after a seven-bit shift, until a byte with its top bit clear ends the quantity.

Parameters
streamThe stream to read from.
Returns
The stream.
Ghidra address:
NTSC-U/C: 0x00405b70
Ghidra address:
PAL: 0x0043f460

Member Data Documentation

◆ mValue

int HxVarLenNumber::mValue

The quantity.


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