C++ Utilities: io/bitreader.cpp Source File

C++ Utilities 5.34.0 Useful C++ classes and routines such as argument parser, IO and conversion utilities

Loading...
Searching...
No Matches
bitreader.cpp
Go to the documentation of this file.
1#include "./bitreader.h"
2
3using namespace std;
4
5namespace CppUtilities {
6
36
43 void BitReader::skipBits(std::size_t bitCount)
44{
45 if (bitCount <= m_bitsAvail) {
46 m_bitsAvail -= static_cast<std::uint8_t>(bitCount);
47 } else {
48 if ((m_buffer += 1 + (bitCount -= m_bitsAvail) / 8) >= m_end) {
49 throw ios_base::failure("end of buffer exceeded");
50 }
51 m_bitsAvail = 8 - (bitCount % 8);
52 }
53}
54
55} // namespace CppUtilities
bitreader.h
CppUtilities::BitReader::skipBits
void skipBits(std::size_t bitCount)
Skips the specified number of bits without reading it.
Definition bitreader.cpp:43
CppUtilities
Contains all utilities provided by the c++utilities library.
Definition argumentparser.h:18
std
STL namespace.