1 /* LzFind.h -- Match finder for LZ algorithms
2 2017-06-10 : Igor Pavlov : Public domain */
11 typedef UInt32 CLzRef
;
13 typedef struct _CMatchFinder
{
20 UInt32 cyclicBufferPos
;
21 UInt32 cyclicBufferSize
; /* it must be = (historySize + 1) */
23 Byte streamEndWasReached
;
38 UInt32 keepSizeBefore
;
42 size_t directInputRem
;
50 UInt64 expectedDataSize
;
53 #define Inline_MatchFinder_GetPointerToCurrentPos(p) ((p)->buffer)
55 #define Inline_MatchFinder_GetNumAvailableBytes(p) ((p)->streamPos - (p)->pos)
57 #define Inline_MatchFinder_IsFinishedOK(p) \
58 ((p)->streamEndWasReached \
59 && (p)->streamPos == (p)->pos \
60 && (!(p)->directInput || (p)->directInputRem == 0))
63 MatchFinder_NeedMove (
68 MatchFinder_GetPointerToCurrentPos (
73 MatchFinder_MoveBlock (
78 MatchFinder_ReadIfRequired (
83 MatchFinder_Construct (
89 keepAddBufferBefore + matchMaxLen + keepAddBufferAfter < 511MB
95 UInt32 keepAddBufferBefore
,
97 UInt32 keepAddBufferAfter
,
108 MatchFinder_Normalize3 (
115 MatchFinder_ReduceOffsets (
127 UInt32 _cyclicBufferPos
,
128 UInt32 _cyclicBufferSize
,
136 Mf_GetNumAvailableBytes_Func must be called before each Mf_GetMatchLen_Func.
137 Mf_GetPointerToCurrentPos_Func's result must be used only before any other function
140 typedef void (*Mf_Init_Func
)(
143 typedef UInt32 (*Mf_GetNumAvailableBytes_Func
)(
146 typedef const Byte
* (*Mf_GetPointerToCurrentPos_Func
)(
149 typedef UInt32 (*Mf_GetMatches_Func
)(
153 typedef void (*Mf_Skip_Func
)(
158 typedef struct _IMatchFinder
{
160 Mf_GetNumAvailableBytes_Func GetNumAvailableBytes
;
161 Mf_GetPointerToCurrentPos_Func GetPointerToCurrentPos
;
162 Mf_GetMatches_Func GetMatches
;
167 MatchFinder_CreateVTable (
173 MatchFinder_Init_LowHash (
178 MatchFinder_Init_HighHash (
194 Bt3Zip_MatchFinder_GetMatches (
200 Hc3Zip_MatchFinder_GetMatches (
206 Bt3Zip_MatchFinder_Skip (
212 Hc3Zip_MatchFinder_Skip (