This commit is contained in:
Igor Pavlov
2021-07-22 23:00:14 +01:00
committed by Kornel
parent 4a960640a3
commit 585698650f
619 changed files with 34904 additions and 10859 deletions

View File

@@ -38,7 +38,18 @@ public:
_value = 0;
}
UInt64 GetStreamSize() const { return _stream.GetStreamSize(); }
// the size of portion data in real stream that was already read from this object.
// it doesn't include unused data in BitStream object buffer (up to 4 bytes)
// it doesn't include unused data in TInByte buffers
// it doesn't include virtual Extra bytes after the end of real stream data
UInt64 GetStreamSize() const
{
return ExtraBitsWereRead() ?
_stream.GetStreamSize():
GetProcessedSize();
}
// the size of virtual data that was read from this object.
UInt64 GetProcessedSize() const { return _stream.GetProcessedSize() - ((kNumBigValueBits - _bitPos) >> 3); }
bool ThereAreDataInBitsBuffer() const { return this->_bitPos != kNumBigValueBits; }
@@ -139,6 +150,17 @@ public:
MovePos(8);
return b;
}
// call it only if the object is aligned for byte.
MY_FORCE_INLINE
bool ReadAlignedByte_FromBuf(Byte &b)
{
if (this->_bitPos == kNumBigValueBits)
return this->_stream.ReadByte_FromBuf(b);
b = (Byte)(_normalValue & 0xFF);
MovePos(8);
return true;
}
};
}