Parolin 0.7.9 6796
Console (soon DLLs) to do a tar like job
Loading...
Searching...
No Matches
LzFind.c File Reference
#include "Precomp.h"
#include <string.h>
#include "CpuArch.h"
#include "LzFind.h"
#include "LzHash.h"

Macros

#define kBlockMoveAlign   (1 << 7)
 
#define kBlockSizeAlign   (1 << 16)
 
#define kBlockSizeReserveMin   (1 << 24)
 
#define kEmptyHashValue   0
 
#define kMaxValForNormalize   ((UInt32)0)
 
#define GET_AVAIL_BYTES(p)
 
#define kFix5HashSize   kFix4HashSize
 
#define HASH2_CALC   hv = GetUi16(cur);
 
#define HASH3_CALC
 
#define HASH4_CALC
 
#define HASH5_CALC
 
#define HASH_ZIP_CALC   hv = ((cur[2] | ((UInt32)cur[0] << 8)) ^ p->crc[cur[1]]) & 0xFFFF;
 
#define kCrcPoly   0xEDB88320
 
#define NUM_REFS_ALIGN_MASK   0xF
 
#define CYC_TO_POS_OFFSET   0
 
#define SASUB_32(i)
 
#define DEFAULT_SaturSub   LzFind_SaturSub_32
 
#define LZFIND_NORM_ALIGN_BLOCK_SIZE   (1 << 7)
 
#define MOVE_POS
 
#define MOVE_POS_RET   MOVE_POS return distances;
 
#define GET_MATCHES_HEADER2(minLen, ret_op)
 
#define GET_MATCHES_HEADER(minLen)
 
#define SKIP_HEADER(minLen)
 
#define MF_PARAMS(p)
 
#define SKIP_FOOTER   SkipMatchesSpec(MF_PARAMS(p)); MOVE_POS } while (--num);
 
#define GET_MATCHES_FOOTER_BASE(_maxLen_, func)
 
#define GET_MATCHES_FOOTER_BT(_maxLen_)
 
#define GET_MATCHES_FOOTER_HC(_maxLen_)
 
#define UPDATE_maxLen
 
#define SET_mmm
 
#define HC_SKIP_HEADER(minLen)
 
#define HC_SKIP_FOOTER
 

Functions

Z7_NO_INLINE void MatchFinder_MoveBlock (CMatchFinder *p)
 
int MatchFinder_NeedMove (CMatchFinder *p)
 
void MatchFinder_ReadIfRequired (CMatchFinder *p)
 
void MatchFinder_Construct (CMatchFinder *p)
 
void MatchFinder_Free (CMatchFinder *p, ISzAllocPtr alloc)
 
int MatchFinder_Create (CMatchFinder *p, UInt32 historySize, UInt32 keepAddBufferBefore, UInt32 matchMaxLen, UInt32 keepAddBufferAfter, ISzAllocPtr alloc)
 
void MatchFinder_Init_LowHash (CMatchFinder *p)
 
void MatchFinder_Init_HighHash (CMatchFinder *p)
 
void MatchFinder_Init_4 (CMatchFinder *p)
 
void MatchFinder_Init (CMatchFinder *p)
 
Z7_NO_INLINE void MatchFinder_Normalize3 (UInt32 subValue, CLzRef *items, size_t numItems)
 
Z7_FORCE_INLINE UInt32GetMatchesSpec1 (UInt32 lenLimit, UInt32 curMatch, UInt32 pos, const Byte *cur, CLzRef *son, size_t _cyclicBufferPos, UInt32 _cyclicBufferSize, UInt32 cutValue, UInt32 *d, UInt32 maxLen)
 
UInt32Bt3Zip_MatchFinder_GetMatches (CMatchFinder *p, UInt32 *distances)
 
UInt32Hc3Zip_MatchFinder_GetMatches (CMatchFinder *p, UInt32 *distances)
 
void Bt3Zip_MatchFinder_Skip (CMatchFinder *p, UInt32 num)
 
void Hc3Zip_MatchFinder_Skip (CMatchFinder *p, UInt32 num)
 
void MatchFinder_CreateVTable (CMatchFinder *p, IMatchFinder2 *vTable)
 
void LzFindPrepare (void)
 

Macro Definition Documentation

◆ CYC_TO_POS_OFFSET

#define CYC_TO_POS_OFFSET   0

◆ DEFAULT_SaturSub

#define DEFAULT_SaturSub   LzFind_SaturSub_32

◆ GET_AVAIL_BYTES

#define GET_AVAIL_BYTES ( p)
Value:
#define Inline_MatchFinder_GetNumAvailableBytes(p)
Definition LzFind.h:58

◆ GET_MATCHES_FOOTER_BASE

#define GET_MATCHES_FOOTER_BASE ( _maxLen_,
func )
Value:
distances = func(MF_PARAMS(p), \
distances, (UInt32)_maxLen_); MOVE_POS_RET
#define MOVE_POS_RET
Definition LzFind.c:1098
#define MF_PARAMS(p)
Definition LzFind.c:1124
unsigned int UInt32
Definition bzlib_private.h:45

◆ GET_MATCHES_FOOTER_BT

#define GET_MATCHES_FOOTER_BT ( _maxLen_)
Value:
Z7_FORCE_INLINE UInt32 * GetMatchesSpec1(UInt32 lenLimit, UInt32 curMatch, UInt32 pos, const Byte *cur, CLzRef *son, size_t _cyclicBufferPos, UInt32 _cyclicBufferSize, UInt32 cutValue, UInt32 *d, UInt32 maxLen)
Definition LzFind.c:962
#define GET_MATCHES_FOOTER_BASE(_maxLen_, func)
Definition LzFind.c:1132

◆ GET_MATCHES_FOOTER_HC

#define GET_MATCHES_FOOTER_HC ( _maxLen_)
Value:
GET_MATCHES_FOOTER_BASE(_maxLen_, Hc_GetMatchesSpec)

◆ GET_MATCHES_HEADER

#define GET_MATCHES_HEADER ( minLen)
Value:
GET_MATCHES_HEADER2(minLen, return distances)
#define GET_MATCHES_HEADER2(minLen, ret_op)
Definition LzFind.c:1114

◆ GET_MATCHES_HEADER2

#define GET_MATCHES_HEADER2 ( minLen,
ret_op )
Value:
unsigned lenLimit; UInt32 hv; const Byte *cur; UInt32 curMatch; \
lenLimit = (unsigned)p->lenLimit; { if (lenLimit < minLen) { MatchFinder_MovePos(p); ret_op; }} \
cur = p->buffer;
unsigned char Byte
Definition zconf.h:391

◆ HASH2_CALC

#define HASH2_CALC   hv = GetUi16(cur);

◆ HASH3_CALC

#define HASH3_CALC
Value:
{ \
UInt32 temp = p->crc[cur[0]] ^ cur[1]; \
h2 = temp & (kHash2Size - 1); \
hv = (temp ^ ((UInt32)cur[2] << 8)) & p->hashMask; }
#define kHash2Size
Definition LzHash.h:12

◆ HASH4_CALC

#define HASH4_CALC
Value:
{ \
UInt32 temp = p->crc[cur[0]] ^ cur[1]; \
h2 = temp & (kHash2Size - 1); \
temp ^= ((UInt32)cur[2] << 8); \
h3 = temp & (kHash3Size - 1); \
hv = (temp ^ (p->crc[cur[3]] << kLzHash_CrcShift_1)) & p->hashMask; }
#define kLzHash_CrcShift_1
Definition LzHash.h:31
#define kHash3Size
Definition LzHash.h:13

◆ HASH5_CALC

#define HASH5_CALC
Value:
{ \
UInt32 temp = p->crc[cur[0]] ^ cur[1]; \
h2 = temp & (kHash2Size - 1); \
temp ^= ((UInt32)cur[2] << 8); \
h3 = temp & (kHash3Size - 1); \
temp ^= (p->crc[cur[3]] << kLzHash_CrcShift_1); \
/* h4 = temp & p->hash4Mask; */ /* (kHash4Size - 1); */ \
hv = (temp ^ (p->crc[cur[4]] << kLzHash_CrcShift_2)) & p->hashMask; }
#define kLzHash_CrcShift_2
Definition LzHash.h:32

◆ HASH_ZIP_CALC

#define HASH_ZIP_CALC   hv = ((cur[2] | ((UInt32)cur[0] << 8)) ^ p->crc[cur[1]]) & 0xFFFF;

◆ HC_SKIP_FOOTER

#define HC_SKIP_FOOTER
Value:
cur++; pos++; *son++ = curMatch; \
} while (--num2); \
p->buffer = cur; \
p->pos = pos; \
if (pos == p->posLimit) MatchFinder_CheckLimits(p); \
}} while(num); \
while(len< limit &&buf1[len]==buf2[len])++len

◆ HC_SKIP_HEADER

#define HC_SKIP_HEADER ( minLen)
Value:
do { if (p->lenLimit < minLen) { MatchFinder_MovePos(p); num--; continue; } { \
const Byte *cur; \
UInt32 *hash; \
UInt32 *son; \
UInt32 pos = p->pos; \
UInt32 num2 = num; \
/* (p->pos == p->posLimit) is not allowed here !!! */ \
{ const UInt32 rem = p->posLimit - pos; if (num2 > rem) num2 = rem; } \
num -= num2; \
{ const UInt32 cycPos = p->cyclicBufferPos; \
son = p->son + cycPos; \
p->cyclicBufferPos = cycPos + num2; } \
cur = p->buffer; \
hash = p->hash; \
do { \
UInt32 curMatch; \
UInt32 hv;

◆ kBlockMoveAlign

#define kBlockMoveAlign   (1 << 7)

◆ kBlockSizeAlign

#define kBlockSizeAlign   (1 << 16)

◆ kBlockSizeReserveMin

#define kBlockSizeReserveMin   (1 << 24)

◆ kCrcPoly

#define kCrcPoly   0xEDB88320

◆ kEmptyHashValue

#define kEmptyHashValue   0

◆ kFix5HashSize

#define kFix5HashSize   kFix4HashSize

◆ kMaxValForNormalize

#define kMaxValForNormalize   ((UInt32)0)

◆ LZFIND_NORM_ALIGN_BLOCK_SIZE

#define LZFIND_NORM_ALIGN_BLOCK_SIZE   (1 << 7)

◆ MF_PARAMS

#define MF_PARAMS ( p)
Value:
lenLimit, curMatch, p->pos, p->buffer, p->son, p->cyclicBufferPos, p->cyclicBufferSize, p->cutValue

◆ MOVE_POS

#define MOVE_POS
Value:
++p->cyclicBufferPos; \
p->buffer++; \
{ const UInt32 pos1 = p->pos + 1; p->pos = pos1; if (pos1 == p->posLimit) MatchFinder_CheckLimits(p); }

◆ MOVE_POS_RET

#define MOVE_POS_RET   MOVE_POS return distances;

◆ NUM_REFS_ALIGN_MASK

#define NUM_REFS_ALIGN_MASK   0xF

◆ SASUB_32

#define SASUB_32 ( i)
Value:
{ UInt32 v = items[i]; if (v < subValue) v = subValue; items[i] = v - subValue; }
lzma_index ** i
Definition index.h:629

◆ SET_mmm

#define SET_mmm
Value:
mmm = p->cyclicBufferSize; \
if (pos < mmm) \
mmm = pos;

◆ SKIP_FOOTER

#define SKIP_FOOTER   SkipMatchesSpec(MF_PARAMS(p)); MOVE_POS } while (--num);

◆ SKIP_HEADER

#define SKIP_HEADER ( minLen)
Value:
do { GET_MATCHES_HEADER2(minLen, continue)

◆ UPDATE_maxLen

#define UPDATE_maxLen
Value:
{ \
const ptrdiff_t diff = (ptrdiff_t)0 - (ptrdiff_t)d2; \
const Byte *c = cur + maxLen; \
const Byte *lim = cur + lenLimit; \
for (; c != lim; c++) if (*(c + diff) != *c) break; \
maxLen = (unsigned)(c - cur); }
#define c(i)
Definition sha256.c:43

Function Documentation

◆ Bt3Zip_MatchFinder_GetMatches()

UInt32 * Bt3Zip_MatchFinder_GetMatches ( CMatchFinder * p,
UInt32 * distances )

◆ Bt3Zip_MatchFinder_Skip()

void Bt3Zip_MatchFinder_Skip ( CMatchFinder * p,
UInt32 num )

◆ GetMatchesSpec1()

Z7_FORCE_INLINE UInt32 * GetMatchesSpec1 ( UInt32 lenLimit,
UInt32 curMatch,
UInt32 pos,
const Byte * cur,
CLzRef * son,
size_t _cyclicBufferPos,
UInt32 _cyclicBufferSize,
UInt32 cutValue,
UInt32 * d,
UInt32 maxLen )

◆ Hc3Zip_MatchFinder_GetMatches()

UInt32 * Hc3Zip_MatchFinder_GetMatches ( CMatchFinder * p,
UInt32 * distances )

◆ Hc3Zip_MatchFinder_Skip()

void Hc3Zip_MatchFinder_Skip ( CMatchFinder * p,
UInt32 num )

◆ LzFindPrepare()

void LzFindPrepare ( void )

◆ MatchFinder_Construct()

void MatchFinder_Construct ( CMatchFinder * p)

◆ MatchFinder_Create()

int MatchFinder_Create ( CMatchFinder * p,
UInt32 historySize,
UInt32 keepAddBufferBefore,
UInt32 matchMaxLen,
UInt32 keepAddBufferAfter,
ISzAllocPtr alloc )

◆ MatchFinder_CreateVTable()

void MatchFinder_CreateVTable ( CMatchFinder * p,
IMatchFinder2 * vTable )

◆ MatchFinder_Free()

void MatchFinder_Free ( CMatchFinder * p,
ISzAllocPtr alloc )

◆ MatchFinder_Init()

void MatchFinder_Init ( CMatchFinder * p)

◆ MatchFinder_Init_4()

void MatchFinder_Init_4 ( CMatchFinder * p)

◆ MatchFinder_Init_HighHash()

void MatchFinder_Init_HighHash ( CMatchFinder * p)

◆ MatchFinder_Init_LowHash()

void MatchFinder_Init_LowHash ( CMatchFinder * p)

◆ MatchFinder_MoveBlock()

Z7_NO_INLINE void MatchFinder_MoveBlock ( CMatchFinder * p)

◆ MatchFinder_NeedMove()

int MatchFinder_NeedMove ( CMatchFinder * p)

◆ MatchFinder_Normalize3()

Z7_NO_INLINE void MatchFinder_Normalize3 ( UInt32 subValue,
CLzRef * items,
size_t numItems )

◆ MatchFinder_ReadIfRequired()

void MatchFinder_ReadIfRequired ( CMatchFinder * p)