Add 'bf_write::WriteBytes'

This commit is contained in:
Kawe Mazidjatari 2023-04-19 01:36:35 +02:00
parent 83d5deb109
commit e51336dd5a
2 changed files with 10 additions and 0 deletions

View File

@ -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;

View File

@ -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
//-----------------------------------------------------------------------------