From e51336dd5a7fa46470b98a369e5fe308c6131fc2 Mon Sep 17 00:00:00 2001 From: Kawe Mazidjatari <48657826+Mauler125@users.noreply.github.com> Date: Wed, 19 Apr 2023 01:36:35 +0200 Subject: [PATCH] Add 'bf_write::WriteBytes' --- r5dev/public/tier1/bitbuf.h | 2 ++ r5dev/tier1/bitbuf.cpp | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/r5dev/public/tier1/bitbuf.h b/r5dev/public/tier1/bitbuf.h index da5ea3e3..9aec7195 100644 --- a/r5dev/public/tier1/bitbuf.h +++ b/r5dev/public/tier1/bitbuf.h @@ -188,6 +188,8 @@ public: // Write a list of bits in. bool WriteBits(const void* pIn, int nBits); + bool WriteBytes(const void* pIn, int nBytes); + // How many bytes are filled in? int GetNumBytesWritten() const; int GetNumBitsWritten() const; diff --git a/r5dev/tier1/bitbuf.cpp b/r5dev/tier1/bitbuf.cpp index a269c2f2..87e42603 100644 --- a/r5dev/tier1/bitbuf.cpp +++ b/r5dev/tier1/bitbuf.cpp @@ -651,6 +651,14 @@ bool bf_write::WriteBits(const void* pInData, int nBits) return !IsOverflowed(); } +//----------------------------------------------------------------------------- +// Purpose: writes a list of bytes to the buffer +//----------------------------------------------------------------------------- +bool bf_write::WriteBytes(const void* pBuf, int nBytes) +{ + return WriteBits(pBuf, nBytes << 3); +} + //----------------------------------------------------------------------------- // Purpose: writes a bit into the buffer //-----------------------------------------------------------------------------