C++ Utilities  4.17.0
Useful C++ classes and routines such as argument parser, IO and conversion utilities
bitreader.cpp
Go to the documentation of this file.
1 #include "./bitreader.h"
2 #include "./catchiofailure.h"
3 
4 using namespace std;
5 
6 namespace IoUtilities {
7 
19 void BitReader::skipBits(std::size_t bitCount)
20 {
21  if (bitCount <= m_bitsAvail) {
22  m_bitsAvail -= bitCount;
23  } else {
24  if ((m_buffer += 1 + (bitCount -= m_bitsAvail) / 8) >= m_end) {
25  throwIoFailure("end of buffer exceeded");
26  }
27  m_bitsAvail = 8 - (bitCount % 8);
28  }
29 }
30 
31 } // namespace IoUtilities
CPP_UTILITIES_EXPORT void throwIoFailure(const char *what)
Throws an std::ios_base::failure with the specified message.
Contains utility classes helping to read and write streams.
Definition: binaryreader.h:10