summaryrefslogtreecommitdiffstats
path: root/other-licenses/7zstub/src/7zip/Common/MSBFDecoder.h
diff options
context:
space:
mode:
authorwolfbeast <mcwerewolf@wolfbeast.com>2019-04-05 20:01:10 +0200
committerwolfbeast <mcwerewolf@wolfbeast.com>2019-04-05 20:01:10 +0200
commitc3b63b831cd2c64700e875b28540212c7c881ac6 (patch)
treeedd98fcbd2004d3b562904f822bf6c3322fc7f52 /other-licenses/7zstub/src/7zip/Common/MSBFDecoder.h
parentd432e068a21c815d5d5e7bcbc1cc8c6e77a7d1e0 (diff)
parentcc07da9cb4d6e7a53f8d953427ffc2bca2e0c2df (diff)
downloadUXP-c3b63b831cd2c64700e875b28540212c7c881ac6.tar
UXP-c3b63b831cd2c64700e875b28540212c7c881ac6.tar.gz
UXP-c3b63b831cd2c64700e875b28540212c7c881ac6.tar.lz
UXP-c3b63b831cd2c64700e875b28540212c7c881ac6.tar.xz
UXP-c3b63b831cd2c64700e875b28540212c7c881ac6.zip
Merge branch 'master' into 816
Diffstat (limited to 'other-licenses/7zstub/src/7zip/Common/MSBFDecoder.h')
-rw-r--r--other-licenses/7zstub/src/7zip/Common/MSBFDecoder.h69
1 files changed, 0 insertions, 69 deletions
diff --git a/other-licenses/7zstub/src/7zip/Common/MSBFDecoder.h b/other-licenses/7zstub/src/7zip/Common/MSBFDecoder.h
deleted file mode 100644
index dad00ecab..000000000
--- a/other-licenses/7zstub/src/7zip/Common/MSBFDecoder.h
+++ /dev/null
@@ -1,69 +0,0 @@
-// MSBFDecoder.h
-// the Most Significant Bit of byte is First
-
-#ifndef __STREAM_MSBFDECODER_H
-#define __STREAM_MSBFDECODER_H
-
-#include "../../Common/Types.h"
-#include "../IStream.h"
-
-namespace NStream {
-namespace NMSBF {
-
-const int kNumBigValueBits = 8 * 4;
-const int kNumValueBytes = 3;
-const int kNumValueBits = 8 * kNumValueBytes;
-
-const UInt32 kMask = (1 << kNumValueBits) - 1;
-
-template<class TInByte>
-class CDecoder
-{
- UInt32 m_BitPos;
- UInt32 m_Value;
-public:
- TInByte m_Stream;
- bool Create(UInt32 bufferSize) { return m_Stream.Create(bufferSize); }
- void SetStream(ISequentialInStream *inStream) { m_Stream.SetStream(inStream);}
- void ReleaseStream() { m_Stream.ReleaseStream();}
-
- void Init()
- {
- m_Stream.Init();
- m_BitPos = kNumBigValueBits;
- Normalize();
- }
-
- UInt64 GetProcessedSize() const
- { return m_Stream.GetProcessedSize() - (kNumBigValueBits - m_BitPos) / 8; }
- UInt32 GetBitPosition() const { return (m_BitPos & 7); }
-
- void Normalize()
- {
- for (;m_BitPos >= 8; m_BitPos -= 8)
- m_Value = (m_Value << 8) | m_Stream.ReadByte();
- }
-
- UInt32 GetValue(UInt32 numBits) const
- {
- // return (m_Value << m_BitPos) >> (kNumBigValueBits - numBits);
- return ((m_Value >> (8 - m_BitPos)) & kMask) >> (kNumValueBits - numBits);
- }
-
- void MovePos(UInt32 numBits)
- {
- m_BitPos += numBits;
- Normalize();
- }
-
- UInt32 ReadBits(UInt32 numBits)
- {
- UInt32 res = GetValue(numBits);
- MovePos(numBits);
- return res;
- }
-};
-
-}}
-
-#endif