#include "ByteUtils.h" #include "BufferBitStream.h" #include int main() { std::vector bytes{"11100101", "00110101", "00010001"}; BufferBitStream stream; for(const auto& byte : bytes) { stream.writeByte(ByteUtils::getFromString(byte)); } unsigned char buffer{0} ; auto valid = stream.readNextNBits(3, buffer); std::cout << "Slice0 is " << ByteUtils::toString(buffer) << std::endl; valid = stream.readNextNBits(3, buffer); std::cout << "Slice1 is " << ByteUtils::toString(buffer) << std::endl; valid = stream.readNextNBits(5, buffer); std::cout << "Slice2 is " << ByteUtils::toString(buffer) << std::endl; valid = stream.readNextNBits(7, buffer); std::cout << "Slice3 is " << ByteUtils::toString(buffer) << std::endl; return 0; }