consolidate all repos to one for archive

This commit is contained in:
2025-01-28 13:46:42 +01:00
commit a6610fbc7a
5350 changed files with 2705721 additions and 0 deletions

View File

@@ -0,0 +1,39 @@
#pragma once
#include "Buffer.hpp"
class BitWriter
{
public:
int k = 0;
Buffer buffer;
char x = 0;
void writeByte(uint8_t x)
{
// f.write((char*)&x, 1);
buffer.add_end(&x, sizeof(uint8_t));
}
void writeInt(int x)
{
buffer.add_end((uint8_t *)&x, sizeof(x));
}
void writeBit(bool b)
{
if (k == 8)
{
writeByte(x);
k = 0;
x = 0;
}
x ^= (-b ^ x) & (1 << k);
k++;
}
void finish()
{
if (k > 0)
writeByte(x);
}
};