RT-AC66 3.0.0.4.374.130 core
[tomato.git] / release / src-rt-6.x / linux / linux-2.6 / scripts / squashfs / lzma / C / 7zip / Compress / LZ / HashChain / HC.h
blob53f3e2175c364dc68fd032792f05a377fc3da292
1 // HC.h
3 #include "../LZInWindow.h"
4 #include "../IMatchFinder.h"
6 namespace HC_NAMESPACE {
8 typedef UInt32 CIndex;
9 const UInt32 kMaxValForNormalize = (UInt32(1) << 31) - 1;
11 class CMatchFinderHC:
12 public IMatchFinder,
13 public IMatchFinderSetCallback,
14 public CLZInWindow,
15 public CMyUnknownImp
17 UInt32 _cyclicBufferPos;
18 UInt32 _cyclicBufferSize; // it must be historySize + 1
19 UInt32 _matchMaxLen;
20 CIndex *_hash;
21 UInt32 _cutValue;
23 CMyComPtr<IMatchFinderCallback> m_Callback;
25 void Normalize();
26 void FreeThisClassMemory();
27 void FreeMemory();
29 MY_UNKNOWN_IMP1(IMatchFinderSetCallback)
31 STDMETHOD(Init)(ISequentialInStream *inStream);
32 STDMETHOD_(void, ReleaseStream)();
33 STDMETHOD(MovePos)();
34 STDMETHOD_(Byte, GetIndexByte)(Int32 index);
35 STDMETHOD_(UInt32, GetMatchLen)(Int32 index, UInt32 back, UInt32 limit);
36 STDMETHOD_(UInt32, GetNumAvailableBytes)();
37 STDMETHOD_(const Byte *, GetPointerToCurrentPos)();
38 STDMETHOD(Create)(UInt32 historySize, UInt32 keepAddBufferBefore,
39 UInt32 matchMaxLen, UInt32 keepAddBufferAfter);
40 STDMETHOD_(UInt32, GetLongestMatch)(UInt32 *distances);
41 STDMETHOD_(void, DummyLongestMatch)();
43 // IMatchFinderSetCallback
44 STDMETHOD(SetCallback)(IMatchFinderCallback *callback);
46 virtual void BeforeMoveBlock();
47 virtual void AfterMoveBlock();
49 public:
50 CMatchFinderHC();
51 virtual ~CMatchFinderHC();
52 void SetCutValue(UInt32 cutValue) { _cutValue = cutValue; }