#ifndef _POORSTREAM_H_
#define _POORSTREAM_H_

#include <stdbool.h>
#include <stdint.h>
#include <string.h>

#include "os.h"

typedef struct poorstream_t {
    uint8_t *pointer;
    uint32_t offset;
    uint64_t mask;
    uint64_t accumulator;
} poorstream_t;

void poorstream_init(poorstream_t *stream, uint8_t *buffer);
void poorstream_flush(poorstream_t *stream);
void poorstream_write_bits(poorstream_t *stream, uint64_t bits, uint32_t num_bits);

#endif  // _POORSTREAM_H_
