BitReader.h 454 B

123456789101112131415161718
  1. #pragma once
  2. #include "foundation/types.h"
  3. class BitReader
  4. {
  5. public:
  6. uint8_t getbits1();
  7. uint32_t getbits(uint32_t n);
  8. uint8_t showbits1() const;
  9. uint32_t showbits(uint32_t n) const;
  10. void flushbits(uint32_t n);
  11. bool empty();
  12. uint32_t size() const; // in bits
  13. void alignbyte(); // aligns bitstream to the next byte (or current byte if already aligned)
  14. void getbytes(void *data, uint32_t n);
  15. //private:
  16. const uint8_t *data;
  17. uint32_t numBits;
  18. };