wowlib 0.0.0
Read & write World of Warcraft client files — a C++26 core
Loading...
Searching...
No Matches
wowlib::db::wdc::BitReader Class Reference

A bounds-guarded little-endian bit reader over a record's byte span. More...

#include <wowlib/db/wdc/bit_stream.hpp>

Public Member Functions

 BitReader (const std::byte *base, std::size_t limit)
std::uint64_t read (std::size_t bitOffset, std::size_t bits) const
 Read bits (<= 64) starting at absolute bit offset bitOffset.

Detailed Description

A bounds-guarded little-endian bit reader over a record's byte span.

Definition at line 16 of file bit_stream.hpp.

Constructor & Destructor Documentation

◆ BitReader()

wowlib::db::wdc::BitReader::BitReader ( const std::byte * base,
std::size_t limit )
inline
Parameters
basethe record's first byte.
limitbytes available from base (bounds guard).

Definition at line 20 of file bit_stream.hpp.

Member Function Documentation

◆ read()

std::uint64_t wowlib::db::wdc::BitReader::read ( std::size_t bitOffset,
std::size_t bits ) const
inline

Read bits (<= 64) starting at absolute bit offset bitOffset.

The value may straddle up to 9 bytes (a 7-bit shift plus 64 bits of payload), so the load happens in two 8-byte halves that are shifted and or-ed back together.

Parameters
bitOffsetthe starting bit position within the record.
bitsthe field width in bits.
Returns
the zero-extended value (0 when the read would overrun).

Definition at line 30 of file bit_stream.hpp.

Referenced by wowlib::db::wdc::WdcImage::fieldRaw().


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