C++ Utilities 5.24.7
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
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
void skipBits(std::size_t bitCount)
Skips the specified number of bits without reading it.
Definition bitreader.cpp:43
Contains all utilities provides by the c++utilities library.
IntegralType stringToNumber(const StringType &string, BaseType base=10)
Converts the given string to an unsigned/signed number assuming string uses the specified base.
STL namespace.