| 328 | } |
| 329 | |
| 330 | bool SubByteReader::canReadBits(unsigned nrBits) const |
| 331 | { |
| 332 | if (this->posInBufferBytes == this->byteVector.size()) |
| 333 | return false; |
| 334 | |
| 335 | assert(this->posInBufferBits <= 8); |
| 336 | const auto curBitsLeft = 8 - this->posInBufferBits; |
| 337 | assert(this->byteVector.size() > this->posInBufferBytes); |
| 338 | const auto entireBytesLeft = this->byteVector.size() - this->posInBufferBytes - 1; |
| 339 | const auto nrBitsLeftToRead = curBitsLeft + entireBytesLeft * 8; |
| 340 | |
| 341 | return nrBits <= nrBitsLeftToRead; |
| 342 | } |
| 343 | |
| 344 | size_t SubByteReader::nrBitsRead() const |
| 345 | { |
no test coverage detected