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

A little-endian bit writer over a record buffer — the encode counterpart of BitReader. More...

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

Public Member Functions

 BitWriter (std::byte *base, std::size_t limit)
void write (std::size_t bitOffset, std::size_t bits, std::uint64_t value)
 Write the low bits of value starting at absolute bit offset bitOffset, overwriting whatever was there.

Detailed Description

A little-endian bit writer over a record buffer — the encode counterpart of BitReader.

write() OVERWRITES (sets and clears each bit), so it works on a zeroed buffer (canonical encode) and for patching an existing record in place alike.

Definition at line 59 of file bit_stream.hpp.

Constructor & Destructor Documentation

◆ BitWriter()

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

Definition at line 63 of file bit_stream.hpp.

Member Function Documentation

◆ write()

void wowlib::db::wdc::BitWriter::write ( std::size_t bitOffset,
std::size_t bits,
std::uint64_t value )
inline

Write the low bits of value starting at absolute bit offset bitOffset, overwriting whatever was there.

Bits that would overrun the buffer are dropped.

Parameters
bitOffsetthe starting bit position within the record.
bitsthe field width in bits (<= 64).
valuethe value whose low bits are written.

Definition at line 71 of file bit_stream.hpp.


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