#ifndef __BIT_WRITER_H__ #define __BIT_WRITER_H__ #include <stdlib.h> #include <stdio.h> #include <stdbool.h> #include <stdint.h> #include <string.h> #include <assert.h> /* A struct for writing to files as streams of individual bits */ struct BitWriter; typedef struct BitWriter BitWriter; BitWriter *BitWriter_init(FILE *file); void BitWriter_free(BitWriter *bw); void BitWriter_write_bit(BitWriter *bw, bool bit); void BitWriter_flush(BitWriter *bw); void BitWriter_write_alpha(BitWriter *bw, uint32_t byte); void BitWriter_write_length(BitWriter *bw, uint32_t length); void BitWriter_write_distance(BitWriter *bw, uint32_t dist); void BitWriter_write_bin(BitWriter *bw, uint32_t bits, int number_to_write); size_t BitWriter_bytes_written(BitWriter *bw); #endif