added method for reading a single bit

experiment/meta_header
Martchus 7 years ago
parent 1677f8fc1b
commit 72b7afb17e
  1. 11
      io/bitreader.h

@ -17,6 +17,7 @@ public:
BitReader(const char *buffer, const char *end);
template<typename intType> intType readBits(byte bitCount);
byte readBit();
template<typename intType> intType showBits(byte bitCount);
void skipBits(std::size_t bitCount);
void align();
@ -77,6 +78,16 @@ intType BitReader::readBits(byte bitCount)
return val;
}
/*!
* \brief Reads the one bit from the buffer advancing the current position by one bit.
* \throws Throws ios_base::failure if the end of the buffer is exceeded.
* The reader becomes invalid in that case.
*/
inline byte BitReader::readBit()
{
return readBits<byte>(1) == 1;
}
/*!
* \brief Reads the specified number of bits from the buffer without advancing the current position.
*/

Loading…
Cancel
Save