From 20d28e80a5c861a9d5f449ea911ab75b4f37ad0d Mon Sep 17 00:00:00 2001 From: Jef Date: Tue, 24 Sep 2024 14:54:57 +0200 Subject: Initial community commit --- Src/nu/bitbuffer.h | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 Src/nu/bitbuffer.h (limited to 'Src/nu/bitbuffer.h') diff --git a/Src/nu/bitbuffer.h b/Src/nu/bitbuffer.h new file mode 100644 index 00000000..71849f7a --- /dev/null +++ b/Src/nu/bitbuffer.h @@ -0,0 +1,26 @@ +#ifndef NULLSOFT_UTILITY_BITBUFFER_H +#define NULLSOFT_UTILITY_BITBUFFER_H +#include +#ifdef _WIN32 +#include +#else +#include +#endif +class BitBuffer +{ +public: + BitBuffer(); + void WriteBit(char bit); + void WriteBits(uintptr_t num, size_t bitlen); + void WriteBytes(void *buffer, size_t bytes); + void WriteByte(unsigned char byte); + unsigned char *Get() { return buffer; } + size_t GetLength() { return length; } + +private: + void Resize(size_t newlen); + unsigned char *buffer; + size_t length; + size_t bits; +}; +#endif \ No newline at end of file -- cgit