diff options
Diffstat (limited to 'CPP/7zip/Compress/BitlEncoder.h')
-rwxr-xr-x | CPP/7zip/Compress/BitlEncoder.h | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/CPP/7zip/Compress/BitlEncoder.h b/CPP/7zip/Compress/BitlEncoder.h index 02f5a9c6..7de57545 100755 --- a/CPP/7zip/Compress/BitlEncoder.h +++ b/CPP/7zip/Compress/BitlEncoder.h @@ -8,12 +8,14 @@ class CBitlEncoder { COutBuffer m_Stream; - int m_BitPos; + unsigned m_BitPos; Byte m_CurByte; public: bool Create(UInt32 bufferSize) { return m_Stream.Create(bufferSize); } void SetStream(ISequentialOutStream *outStream) { m_Stream.SetStream(outStream); } void ReleaseStream() { m_Stream.ReleaseStream(); } + UInt32 GetBitPosition() const { return (8 - m_BitPos); } + UInt64 GetProcessedSize() const { return m_Stream.GetProcessedSize() + (8 - m_BitPos + 7) /8; } void Init() { m_Stream.Init(); @@ -25,18 +27,16 @@ public: FlushByte(); return m_Stream.Flush(); } - void FlushByte() { - if(m_BitPos < 8) + if (m_BitPos < 8) m_Stream.WriteByte(m_CurByte); m_BitPos = 8; m_CurByte = 0; } - - void WriteBits(UInt32 value, int numBits) + void WriteBits(UInt32 value, unsigned numBits) { - while(numBits > 0) + while (numBits > 0) { if (numBits < m_BitPos) { @@ -51,9 +51,6 @@ public: m_CurByte = 0; } } - UInt32 GetBitPosition() const { return (8 - m_BitPos); } - UInt64 GetProcessedSize() const { - return m_Stream.GetProcessedSize() + (8 - m_BitPos + 7) /8; } void WriteByte(Byte b) { m_Stream.WriteByte(b);} }; |