Don't udpate LastOverSpeedTick when using aqua_speed
[ryzomcore.git] / nel / 3rdparty / seven_zip / LzFind.h
blob42c13be157c17c552a4fabca2defafa5230e955b
1 /* LzFind.h -- Match finder for LZ algorithms
2 2017-06-10 : Igor Pavlov : Public domain */
4 #ifndef __LZ_FIND_H
5 #define __LZ_FIND_H
7 #include "7zTypes.h"
9 EXTERN_C_BEGIN
11 typedef UInt32 CLzRef;
13 typedef struct _CMatchFinder
15 Byte *buffer;
16 UInt32 pos;
17 UInt32 posLimit;
18 UInt32 streamPos;
19 UInt32 lenLimit;
21 UInt32 cyclicBufferPos;
22 UInt32 cyclicBufferSize; /* it must be = (historySize + 1) */
24 Byte streamEndWasReached;
25 Byte btMode;
26 Byte bigHash;
27 Byte directInput;
29 UInt32 matchMaxLen;
30 CLzRef *hash;
31 CLzRef *son;
32 UInt32 hashMask;
33 UInt32 cutValue;
35 Byte *bufferBase;
36 ISeqInStream *stream;
38 UInt32 blockSize;
39 UInt32 keepSizeBefore;
40 UInt32 keepSizeAfter;
42 UInt32 numHashBytes;
43 size_t directInputRem;
44 UInt32 historySize;
45 UInt32 fixedHashSize;
46 UInt32 hashSizeSum;
47 SRes result;
48 UInt32 crc[256];
49 size_t numRefs;
51 UInt64 expectedDataSize;
52 } CMatchFinder;
54 #define Inline_MatchFinder_GetPointerToCurrentPos(p) ((p)->buffer)
56 #define Inline_MatchFinder_GetNumAvailableBytes(p) ((p)->streamPos - (p)->pos)
58 #define Inline_MatchFinder_IsFinishedOK(p) \
59 ((p)->streamEndWasReached \
60 && (p)->streamPos == (p)->pos \
61 && (!(p)->directInput || (p)->directInputRem == 0))
63 int MatchFinder_NeedMove(CMatchFinder *p);
64 Byte *MatchFinder_GetPointerToCurrentPos(CMatchFinder *p);
65 void MatchFinder_MoveBlock(CMatchFinder *p);
66 void MatchFinder_ReadIfRequired(CMatchFinder *p);
68 void MatchFinder_Construct(CMatchFinder *p);
70 /* Conditions:
71 historySize <= 3 GB
72 keepAddBufferBefore + matchMaxLen + keepAddBufferAfter < 511MB
74 int MatchFinder_Create(CMatchFinder *p, UInt32 historySize,
75 UInt32 keepAddBufferBefore, UInt32 matchMaxLen, UInt32 keepAddBufferAfter,
76 ISzAllocPtr alloc);
77 void MatchFinder_Free(CMatchFinder *p, ISzAllocPtr alloc);
78 void MatchFinder_Normalize3(UInt32 subValue, CLzRef *items, size_t numItems);
79 void MatchFinder_ReduceOffsets(CMatchFinder *p, UInt32 subValue);
81 UInt32 * GetMatchesSpec1(UInt32 lenLimit, UInt32 curMatch, UInt32 pos, const Byte *buffer, CLzRef *son,
82 UInt32 _cyclicBufferPos, UInt32 _cyclicBufferSize, UInt32 _cutValue,
83 UInt32 *distances, UInt32 maxLen);
86 Conditions:
87 Mf_GetNumAvailableBytes_Func must be called before each Mf_GetMatchLen_Func.
88 Mf_GetPointerToCurrentPos_Func's result must be used only before any other function
91 typedef void (*Mf_Init_Func)(void *object);
92 typedef UInt32 (*Mf_GetNumAvailableBytes_Func)(void *object);
93 typedef const Byte * (*Mf_GetPointerToCurrentPos_Func)(void *object);
94 typedef UInt32 (*Mf_GetMatches_Func)(void *object, UInt32 *distances);
95 typedef void (*Mf_Skip_Func)(void *object, UInt32);
97 typedef struct _IMatchFinder
99 Mf_Init_Func Init;
100 Mf_GetNumAvailableBytes_Func GetNumAvailableBytes;
101 Mf_GetPointerToCurrentPos_Func GetPointerToCurrentPos;
102 Mf_GetMatches_Func GetMatches;
103 Mf_Skip_Func Skip;
104 } IMatchFinder;
106 void MatchFinder_CreateVTable(CMatchFinder *p, IMatchFinder *vTable);
108 void MatchFinder_Init_LowHash(CMatchFinder *p);
109 void MatchFinder_Init_HighHash(CMatchFinder *p);
110 void MatchFinder_Init_3(CMatchFinder *p, int readData);
111 void MatchFinder_Init(CMatchFinder *p);
113 UInt32 Bt3Zip_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances);
114 UInt32 Hc3Zip_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances);
116 void Bt3Zip_MatchFinder_Skip(CMatchFinder *p, UInt32 num);
117 void Hc3Zip_MatchFinder_Skip(CMatchFinder *p, UInt32 num);
119 EXTERN_C_END
121 #endif