Lines Matching refs:U32
31 static const U32 g_searchStrength = 8; /* control skip over incompressible data */
57 U32 dictLimit; /* below that point, need extDict */
58 U32 lowLimit; /* below that point, no more data */
59 U32 nextToUpdate; /* index from which to continue dictionary update */
60 U32 nextToUpdate3; /* index from which to continue dictionary update */
61 U32 hashLog3; /* dispatch table : larger == faster, more memory */
62 U32 loadedDictEnd; /* index of end of dictionary */
63 U32 forceWindow; /* force back-references to respect limit of 1<<wLog, even for dictionary */
64 U32 forceRawDict; /* Force loading dictionary in "content-only" mode (no header analysis) */
66 U32 rep[ZSTD_REP_NUM];
67 U32 repToConfirm[ZSTD_REP_NUM];
68 U32 dictID;
78 U32 *hashTable;
79 U32 *hashTable3;
80 U32 *chainTable;
82 U32 flagStaticTables;
93 U32 const divider = (cParams.searchLength == 3) ? 3 : 4; in ZSTD_CCtxWorkspaceBound()
98 U32 const hashLog3 = (cParams.searchLength > 3) ? 0 : MIN(ZSTD_HASHLOG3_MAX, cParams.windowLog); in ZSTD_CCtxWorkspaceBound()
100 size_t const tableSpace = (chainSize + hSize + h3Size) * sizeof(U32); in ZSTD_CCtxWorkspaceBound()
102 …((MaxML + 1) + (MaxLL + 1) + (MaxOff + 1) + (1 << Litbits)) * sizeof(U32) + (ZSTD_OPT_NUM + 1) * (… in ZSTD_CCtxWorkspaceBound()
103 size_t const workspaceSize = tableSpace + (256 * sizeof(U32)) /* huffTable */ + tokenSpace + in ZSTD_CCtxWorkspaceBound()
161 if ((U32)(cParams.strategy) > (U32)ZSTD_btopt2) in ZSTD_checkCParams()
168 static U32 ZSTD_cycleLog(U32 hashLog, ZSTD_strategy strat) in ZSTD_cycleLog()
170 U32 const btScale = ((U32)strat >= (U32)ZSTD_btlazy2); in ZSTD_cycleLog()
187 U32 const minSrcSize = (srcSize == 0) ? 500 : 0; in ZSTD_adjustCParams()
190 U32 const srcLog = MAX(ZSTD_HASHLOG_MIN, ZSTD_highbit32((U32)(rSize)-1) + 1); in ZSTD_adjustCParams()
198 U32 const cycleLog = ZSTD_cycleLog(cPar.chainLog, cPar.strategy); in ZSTD_adjustCParams()
209 static U32 ZSTD_equivalentParams(ZSTD_parameters param1, ZSTD_parameters param2) in ZSTD_equivalentParams()
219 U32 const end = (U32)(cctx->nextSrc - cctx->base); in ZSTD_continueCCtx()
253 U32 const divider = (params.cParams.searchLength == 3) ? 3 : 4; in ZSTD_resetCCtx_advanced()
258 …U32 const hashLog3 = (params.cParams.searchLength > 3) ? 0 : MIN(ZSTD_HASHLOG3_MAX, params.cParams… in ZSTD_resetCCtx_advanced()
260 size_t const tableSpace = (chainSize + hSize + h3Size) * sizeof(U32); in ZSTD_resetCCtx_advanced()
265 …size_t const optSpace = ((MaxML + 1) + (MaxLL + 1) + (MaxOff + 1) + (1 << Litbits)) * sizeof(U32) + in ZSTD_resetCCtx_advanced()
267 size_t const neededSpace = tableSpace + (256 * sizeof(U32)) /* huffTable */ + tokenSpace + in ZSTD_resetCCtx_advanced()
282 zc->hashTable = (U32 *)(zc->workSpace); in ZSTD_resetCCtx_advanced()
289 ptr = ((U32 *)ptr) + 256; /* note : HUF_CElt* is incomplete type, size is simulated using U32 */ in ZSTD_resetCCtx_advanced()
307 zc->seqStore.litFreq = (U32 *)ptr; in ZSTD_resetCCtx_advanced()
365 size_t const tableSpace = (chainSize + hSize + h3Size) * sizeof(U32); in ZSTD_copyCCtx()
397 static void ZSTD_reduceTable(U32 *const table, U32 const size, U32 const reducerValue) in ZSTD_reduceTable()
399 U32 u; in ZSTD_reduceTable()
410 static void ZSTD_reduceIndex(ZSTD_CCtx *zc, const U32 reducerValue) in ZSTD_reduceIndex()
413 U32 const hSize = 1 << zc->params.cParams.hashLog; in ZSTD_reduceIndex()
418 …U32 const chainSize = (zc->params.cParams.strategy == ZSTD_fast) ? 0 : (1 << zc->params.cParams.ch… in ZSTD_reduceIndex()
423 U32 const h3Size = (zc->hashLog3) ? 1 << zc->hashLog3 : 0; in ZSTD_reduceIndex()
439 ZSTD_writeLE24(dst, (U32)(srcSize << 2) + (U32)bt_raw); in ZSTD_noCompressBlock()
446 U32 const flSize = 1 + (srcSize > 31) + (srcSize > 4095); in ZSTD_noCompressLiterals()
452 case 1: /* 2 - 1 - 5 */ ostart[0] = (BYTE)((U32)set_basic + (srcSize << 3)); break; in ZSTD_noCompressLiterals()
453 …case 2: /* 2 - 2 - 12 */ ZSTD_writeLE16(ostart, (U16)((U32)set_basic + (1 << 2) + (srcSize << 4)))… in ZSTD_noCompressLiterals()
455 …case 3: /* 2 - 2 - 20 */ ZSTD_writeLE32(ostart, (U32)((U32)set_basic + (3 << 2) + (srcSize << 4)))… in ZSTD_noCompressLiterals()
465 U32 const flSize = 1 + (srcSize > 31) + (srcSize > 4095); in ZSTD_compressRleLiteralsBlock()
470 case 1: /* 2 - 1 - 5 */ ostart[0] = (BYTE)((U32)set_rle + (srcSize << 3)); break; in ZSTD_compressRleLiteralsBlock()
471 …case 2: /* 2 - 2 - 12 */ ZSTD_writeLE16(ostart, (U16)((U32)set_rle + (1 << 2) + (srcSize << 4))); … in ZSTD_compressRleLiteralsBlock()
473 …case 3: /* 2 - 2 - 20 */ ZSTD_writeLE32(ostart, (U32)((U32)set_rle + (3 << 2) + (srcSize << 4))); … in ZSTD_compressRleLiteralsBlock()
487 U32 singleStream = srcSize < 256; in ZSTD_compressLiterals()
531 U32 const lhc = hType + ((!singleStream) << 2) + ((U32)srcSize << 4) + ((U32)cLitSize << 14); in ZSTD_compressLiterals()
537 U32 const lhc = hType + (2 << 2) + ((U32)srcSize << 4) + ((U32)cLitSize << 18); in ZSTD_compressLiterals()
544 U32 const lhc = hType + (3 << 2) + ((U32)srcSize << 4) + ((U32)cLitSize << 22); in ZSTD_compressLiterals()
571 U32 const nbSeq = (U32)(seqStorePtr->sequences - seqStorePtr->sequencesStart); in ZSTD_seqToCodes()
572 U32 u; in ZSTD_seqToCodes()
574 U32 const llv = sequences[u].litLength; in ZSTD_seqToCodes()
575 U32 const mlv = sequences[u].matchLength; in ZSTD_seqToCodes()
593 U32 LLtype, Offtype, MLtype; /* compressed, raw or rle */ in ZSTD_compressSequences_internal()
604 U32 *count; in ZSTD_compressSequences_internal()
606 U32 *workspace; in ZSTD_compressSequences_internal()
610 count = (U32 *)zc->tmpCounters + spaceUsed32; in ZSTD_compressSequences_internal()
612 norm = (S16 *)((U32 *)zc->tmpCounters + spaceUsed32); in ZSTD_compressSequences_internal()
613 spaceUsed32 += ALIGN(sizeof(S16) * (MaxSeq + 1), sizeof(U32)) >> 2; in ZSTD_compressSequences_internal()
615 workspace = (U32 *)zc->tmpCounters + spaceUsed32; in ZSTD_compressSequences_internal()
652 U32 max = MaxLL; in ZSTD_compressSequences_internal()
665 const U32 tableLog = FSE_optimalTableLog(LLFSELog, nbSeq, max); in ZSTD_compressSequences_internal()
684 U32 max = MaxOff; in ZSTD_compressSequences_internal()
697 const U32 tableLog = FSE_optimalTableLog(OffFSELog, nbSeq, max); in ZSTD_compressSequences_internal()
716 U32 max = MaxML; in ZSTD_compressSequences_internal()
729 const U32 tableLog = FSE_optimalTableLog(MLFSELog, nbSeq, max); in ZSTD_compressSequences_internal()
769 U32 const ofBits = ofCodeTable[nbSeq - 1]; in ZSTD_compressSequences_internal()
787 U32 const llBits = LL_bits[llCode]; in ZSTD_compressSequences_internal()
788 U32 const ofBits = ofCode; /* 32b*/ /* 64b*/ in ZSTD_compressSequences_internal()
789 U32 const mlBits = ML_bits[mlCode]; in ZSTD_compressSequences_internal()
861 ZSTD_STATIC void ZSTD_storeSeq(seqStore_t *seqStorePtr, size_t litLength, const void *literals, U32… in ZSTD_storeSeq()
870 seqStorePtr->longLengthPos = (U32)(seqStorePtr->sequences - seqStorePtr->sequencesStart); in ZSTD_storeSeq()
880 seqStorePtr->longLengthPos = (U32)(seqStorePtr->sequences - seqStorePtr->sequencesStart); in ZSTD_storeSeq()
896 return (__builtin_ctz((U32)val) >> 3); in ZSTD_NbCommonBytes()
902 return (__builtin_clz((U32)val) >> 3); in ZSTD_NbCommonBytes()
952 static const U32 prime3bytes = 506832829U;
953 static U32 ZSTD_hash3(U32 u, U32 h) { return ((u << (32 - 24)) * prime3bytes) >> (32 - h); } in ZSTD_hash3()
954 ZSTD_STATIC size_t ZSTD_hash3Ptr(const void *ptr, U32 h) { return ZSTD_hash3(ZSTD_readLE32(ptr), h)… in ZSTD_hash3Ptr()
956 static const U32 prime4bytes = 2654435761U;
957 static U32 ZSTD_hash4(U32 u, U32 h) { return (u * prime4bytes) >> (32 - h); } in ZSTD_hash4()
958 static size_t ZSTD_hash4Ptr(const void *ptr, U32 h) { return ZSTD_hash4(ZSTD_read32(ptr), h); } in ZSTD_hash4Ptr()
961 static size_t ZSTD_hash5(U64 u, U32 h) { return (size_t)(((u << (64 - 40)) * prime5bytes) >> (64 - … in ZSTD_hash5()
962 static size_t ZSTD_hash5Ptr(const void *p, U32 h) { return ZSTD_hash5(ZSTD_readLE64(p), h); } in ZSTD_hash5Ptr()
965 static size_t ZSTD_hash6(U64 u, U32 h) { return (size_t)(((u << (64 - 48)) * prime6bytes) >> (64 - … in ZSTD_hash6()
966 static size_t ZSTD_hash6Ptr(const void *p, U32 h) { return ZSTD_hash6(ZSTD_readLE64(p), h); } in ZSTD_hash6Ptr()
969 static size_t ZSTD_hash7(U64 u, U32 h) { return (size_t)(((u << (64 - 56)) * prime7bytes) >> (64 - … in ZSTD_hash7()
970 static size_t ZSTD_hash7Ptr(const void *p, U32 h) { return ZSTD_hash7(ZSTD_readLE64(p), h); } in ZSTD_hash7Ptr()
973 static size_t ZSTD_hash8(U64 u, U32 h) { return (size_t)(((u)*prime8bytes) >> (64 - h)); } in ZSTD_hash8()
974 static size_t ZSTD_hash8Ptr(const void *p, U32 h) { return ZSTD_hash8(ZSTD_readLE64(p), h); } in ZSTD_hash8Ptr()
976 static size_t ZSTD_hashPtr(const void *p, U32 hBits, U32 mls) in ZSTD_hashPtr()
992 static void ZSTD_fillHashTable(ZSTD_CCtx *zc, const void *end, const U32 mls) in ZSTD_fillHashTable()
994 U32 *const hashTable = zc->hashTable; in ZSTD_fillHashTable()
995 U32 const hBits = zc->params.cParams.hashLog; in ZSTD_fillHashTable()
1002 hashTable[ZSTD_hashPtr(ip, hBits, mls)] = (U32)(ip - base); in ZSTD_fillHashTable()
1008 void ZSTD_compressBlock_fast_generic(ZSTD_CCtx *cctx, const void *src, size_t srcSize, const U32 ml… in ZSTD_compressBlock_fast_generic()
1010 U32 *const hashTable = cctx->hashTable; in ZSTD_compressBlock_fast_generic()
1011 U32 const hBits = cctx->params.cParams.hashLog; in ZSTD_compressBlock_fast_generic()
1017 const U32 lowestIndex = cctx->dictLimit; in ZSTD_compressBlock_fast_generic()
1021 U32 offset_1 = cctx->rep[0], offset_2 = cctx->rep[1]; in ZSTD_compressBlock_fast_generic()
1022 U32 offsetSaved = 0; in ZSTD_compressBlock_fast_generic()
1027 U32 const maxRep = (U32)(ip - lowest); in ZSTD_compressBlock_fast_generic()
1038 U32 const curr = (U32)(ip - base); in ZSTD_compressBlock_fast_generic()
1039 U32 const matchIndex = hashTable[h]; in ZSTD_compressBlock_fast_generic()
1048 U32 offset; in ZSTD_compressBlock_fast_generic()
1054 offset = (U32)(ip - match); in ZSTD_compressBlock_fast_generic()
1073 hashTable[ZSTD_hashPtr(ip - 2, hBits, mls)] = (U32)(ip - 2 - base); in ZSTD_compressBlock_fast_generic()
1079 U32 const tmpOff = offset_2; in ZSTD_compressBlock_fast_generic()
1083 hashTable[ZSTD_hashPtr(ip, hBits, mls)] = (U32)(ip - base); in ZSTD_compressBlock_fast_generic()
1106 const U32 mls = ctx->params.cParams.searchLength; in ZSTD_compressBlock_fast()
1116 …_compressBlock_fast_extDict_generic(ZSTD_CCtx *ctx, const void *src, size_t srcSize, const U32 mls) in ZSTD_compressBlock_fast_extDict_generic()
1118 U32 *hashTable = ctx->hashTable; in ZSTD_compressBlock_fast_extDict_generic()
1119 const U32 hBits = ctx->params.cParams.hashLog; in ZSTD_compressBlock_fast_extDict_generic()
1126 const U32 lowestIndex = ctx->lowLimit; in ZSTD_compressBlock_fast_extDict_generic()
1128 const U32 dictLimit = ctx->dictLimit; in ZSTD_compressBlock_fast_extDict_generic()
1133 U32 offset_1 = ctx->rep[0], offset_2 = ctx->rep[1]; in ZSTD_compressBlock_fast_extDict_generic()
1138 const U32 matchIndex = hashTable[h]; in ZSTD_compressBlock_fast_extDict_generic()
1141 const U32 curr = (U32)(ip - base); in ZSTD_compressBlock_fast_extDict_generic()
1142 const U32 repIndex = curr + 1 - offset_1; /* offset_1 expected <= curr +1 */ in ZSTD_compressBlock_fast_extDict_generic()
1148 …if ((((U32)((dictLimit - 1) - repIndex) >= 3) /* intentional underflow */ & (repIndex > lowestInde… in ZSTD_compressBlock_fast_extDict_generic()
1162 U32 offset; in ZSTD_compressBlock_fast_extDict_generic()
1183 hashTable[ZSTD_hashPtr(ip - 2, hBits, mls)] = (U32)(ip - 2 - base); in ZSTD_compressBlock_fast_extDict_generic()
1186 U32 const curr2 = (U32)(ip - base); in ZSTD_compressBlock_fast_extDict_generic()
1187 U32 const repIndex2 = curr2 - offset_2; in ZSTD_compressBlock_fast_extDict_generic()
1189 …if ((((U32)((dictLimit - 1) - repIndex2) >= 3) & (repIndex2 > lowestIndex)) /* intentional overflo… in ZSTD_compressBlock_fast_extDict_generic()
1194 U32 tmpOffset = offset_2; in ZSTD_compressBlock_fast_extDict_generic()
1222 U32 const mls = ctx->params.cParams.searchLength; in ZSTD_compressBlock_fast_extDict()
1235 static void ZSTD_fillDoubleHashTable(ZSTD_CCtx *cctx, const void *end, const U32 mls) in ZSTD_fillDoubleHashTable()
1237 U32 *const hashLarge = cctx->hashTable; in ZSTD_fillDoubleHashTable()
1238 U32 const hBitsL = cctx->params.cParams.hashLog; in ZSTD_fillDoubleHashTable()
1239 U32 *const hashSmall = cctx->chainTable; in ZSTD_fillDoubleHashTable()
1240 U32 const hBitsS = cctx->params.cParams.chainLog; in ZSTD_fillDoubleHashTable()
1247 hashSmall[ZSTD_hashPtr(ip, hBitsS, mls)] = (U32)(ip - base); in ZSTD_fillDoubleHashTable()
1248 hashLarge[ZSTD_hashPtr(ip, hBitsL, 8)] = (U32)(ip - base); in ZSTD_fillDoubleHashTable()
1254 …D_compressBlock_doubleFast_generic(ZSTD_CCtx *cctx, const void *src, size_t srcSize, const U32 mls) in ZSTD_compressBlock_doubleFast_generic()
1256 U32 *const hashLong = cctx->hashTable; in ZSTD_compressBlock_doubleFast_generic()
1257 const U32 hBitsL = cctx->params.cParams.hashLog; in ZSTD_compressBlock_doubleFast_generic()
1258 U32 *const hashSmall = cctx->chainTable; in ZSTD_compressBlock_doubleFast_generic()
1259 const U32 hBitsS = cctx->params.cParams.chainLog; in ZSTD_compressBlock_doubleFast_generic()
1265 const U32 lowestIndex = cctx->dictLimit; in ZSTD_compressBlock_doubleFast_generic()
1269 U32 offset_1 = cctx->rep[0], offset_2 = cctx->rep[1]; in ZSTD_compressBlock_doubleFast_generic()
1270 U32 offsetSaved = 0; in ZSTD_compressBlock_doubleFast_generic()
1275 U32 const maxRep = (U32)(ip - lowest); in ZSTD_compressBlock_doubleFast_generic()
1287 U32 const curr = (U32)(ip - base); in ZSTD_compressBlock_doubleFast_generic()
1288 U32 const matchIndexL = hashLong[h2]; in ZSTD_compressBlock_doubleFast_generic()
1289 U32 const matchIndexS = hashSmall[h]; in ZSTD_compressBlock_doubleFast_generic()
1299 U32 offset; in ZSTD_compressBlock_doubleFast_generic()
1302 offset = (U32)(ip - matchLong); in ZSTD_compressBlock_doubleFast_generic()
1310 U32 const matchIndex3 = hashLong[h3]; in ZSTD_compressBlock_doubleFast_generic()
1316 offset = (U32)(ip - match3); in ZSTD_compressBlock_doubleFast_generic()
1324 offset = (U32)(ip - match); in ZSTD_compressBlock_doubleFast_generic()
1350 …hashLong[ZSTD_hashPtr(ip - 2, hBitsL, 8)] = hashSmall[ZSTD_hashPtr(ip - 2, hBitsS, mls)] = (U32)(i… in ZSTD_compressBlock_doubleFast_generic()
1357 U32 const tmpOff = offset_2; in ZSTD_compressBlock_doubleFast_generic()
1361 hashSmall[ZSTD_hashPtr(ip, hBitsS, mls)] = (U32)(ip - base); in ZSTD_compressBlock_doubleFast_generic()
1362 hashLong[ZSTD_hashPtr(ip, hBitsL, 8)] = (U32)(ip - base); in ZSTD_compressBlock_doubleFast_generic()
1385 const U32 mls = ctx->params.cParams.searchLength; in ZSTD_compressBlock_doubleFast()
1395 …essBlock_doubleFast_extDict_generic(ZSTD_CCtx *ctx, const void *src, size_t srcSize, const U32 mls) in ZSTD_compressBlock_doubleFast_extDict_generic()
1397 U32 *const hashLong = ctx->hashTable; in ZSTD_compressBlock_doubleFast_extDict_generic()
1398 U32 const hBitsL = ctx->params.cParams.hashLog; in ZSTD_compressBlock_doubleFast_extDict_generic()
1399 U32 *const hashSmall = ctx->chainTable; in ZSTD_compressBlock_doubleFast_extDict_generic()
1400 U32 const hBitsS = ctx->params.cParams.chainLog; in ZSTD_compressBlock_doubleFast_extDict_generic()
1407 const U32 lowestIndex = ctx->lowLimit; in ZSTD_compressBlock_doubleFast_extDict_generic()
1409 const U32 dictLimit = ctx->dictLimit; in ZSTD_compressBlock_doubleFast_extDict_generic()
1414 U32 offset_1 = ctx->rep[0], offset_2 = ctx->rep[1]; in ZSTD_compressBlock_doubleFast_extDict_generic()
1419 const U32 matchIndex = hashSmall[hSmall]; in ZSTD_compressBlock_doubleFast_extDict_generic()
1424 const U32 matchLongIndex = hashLong[hLong]; in ZSTD_compressBlock_doubleFast_extDict_generic()
1428 const U32 curr = (U32)(ip - base); in ZSTD_compressBlock_doubleFast_extDict_generic()
1429 const U32 repIndex = curr + 1 - offset_1; /* offset_1 expected <= curr +1 */ in ZSTD_compressBlock_doubleFast_extDict_generic()
1435 …if ((((U32)((dictLimit - 1) - repIndex) >= 3) /* intentional underflow */ & (repIndex > lowestInde… in ZSTD_compressBlock_doubleFast_extDict_generic()
1445 U32 offset; in ZSTD_compressBlock_doubleFast_extDict_generic()
1459 U32 const matchIndex3 = hashLong[h3]; in ZSTD_compressBlock_doubleFast_extDict_generic()
1462 U32 offset; in ZSTD_compressBlock_doubleFast_extDict_generic()
1504 hashSmall[ZSTD_hashPtr(ip - 2, hBitsS, mls)] = (U32)(ip - 2 - base); in ZSTD_compressBlock_doubleFast_extDict_generic()
1505 hashLong[ZSTD_hashPtr(ip - 2, hBitsL, 8)] = (U32)(ip - 2 - base); in ZSTD_compressBlock_doubleFast_extDict_generic()
1508 U32 const curr2 = (U32)(ip - base); in ZSTD_compressBlock_doubleFast_extDict_generic()
1509 U32 const repIndex2 = curr2 - offset_2; in ZSTD_compressBlock_doubleFast_extDict_generic()
1511 …if ((((U32)((dictLimit - 1) - repIndex2) >= 3) & (repIndex2 > lowestIndex)) /* intentional overflo… in ZSTD_compressBlock_doubleFast_extDict_generic()
1516 U32 tmpOffset = offset_2; in ZSTD_compressBlock_doubleFast_extDict_generic()
1545 U32 const mls = ctx->params.cParams.searchLength; in ZSTD_compressBlock_doubleFast_extDict()
1561 static U32 ZSTD_insertBt1(ZSTD_CCtx *zc, const BYTE *const ip, const U32 mls, const BYTE *const ien… in ZSTD_insertBt1()
1563 U32 *const hashTable = zc->hashTable; in ZSTD_insertBt1()
1564 U32 const hashLog = zc->params.cParams.hashLog; in ZSTD_insertBt1()
1566 U32 *const bt = zc->chainTable; in ZSTD_insertBt1()
1567 U32 const btLog = zc->params.cParams.chainLog - 1; in ZSTD_insertBt1()
1568 U32 const btMask = (1 << btLog) - 1; in ZSTD_insertBt1()
1569 U32 matchIndex = hashTable[h]; in ZSTD_insertBt1()
1573 const U32 dictLimit = zc->dictLimit; in ZSTD_insertBt1()
1577 const U32 curr = (U32)(ip - base); in ZSTD_insertBt1()
1578 const U32 btLow = btMask >= curr ? 0 : curr - btMask; in ZSTD_insertBt1()
1579 U32 *smallerPtr = bt + 2 * (curr & btMask); in ZSTD_insertBt1()
1580 U32 *largerPtr = smallerPtr + 1; in ZSTD_insertBt1()
1581 U32 dummy32; /* to be nullified at the end */ in ZSTD_insertBt1()
1582 U32 const windowLow = zc->lowLimit; in ZSTD_insertBt1()
1583 U32 matchEndIdx = curr + 8; in ZSTD_insertBt1()
1589 U32 *const nextPtr = bt + 2 * (matchIndex & btMask); in ZSTD_insertBt1()
1606 matchEndIdx = matchIndex + (U32)matchLength; in ZSTD_insertBt1()
1637 return MIN(192, (U32)(bestLength - 384)); /* speed optimization */ in ZSTD_insertBt1()
1643 …zc, const BYTE *const ip, const BYTE *const iend, size_t *offsetPtr, U32 nbCompares, const U32 mls, in ZSTD_insertBtAndFindBestMatch()
1644 U32 extDict) in ZSTD_insertBtAndFindBestMatch()
1646 U32 *const hashTable = zc->hashTable; in ZSTD_insertBtAndFindBestMatch()
1647 U32 const hashLog = zc->params.cParams.hashLog; in ZSTD_insertBtAndFindBestMatch()
1649 U32 *const bt = zc->chainTable; in ZSTD_insertBtAndFindBestMatch()
1650 U32 const btLog = zc->params.cParams.chainLog - 1; in ZSTD_insertBtAndFindBestMatch()
1651 U32 const btMask = (1 << btLog) - 1; in ZSTD_insertBtAndFindBestMatch()
1652 U32 matchIndex = hashTable[h]; in ZSTD_insertBtAndFindBestMatch()
1656 const U32 dictLimit = zc->dictLimit; in ZSTD_insertBtAndFindBestMatch()
1659 const U32 curr = (U32)(ip - base); in ZSTD_insertBtAndFindBestMatch()
1660 const U32 btLow = btMask >= curr ? 0 : curr - btMask; in ZSTD_insertBtAndFindBestMatch()
1661 const U32 windowLow = zc->lowLimit; in ZSTD_insertBtAndFindBestMatch()
1662 U32 *smallerPtr = bt + 2 * (curr & btMask); in ZSTD_insertBtAndFindBestMatch()
1663 U32 *largerPtr = bt + 2 * (curr & btMask) + 1; in ZSTD_insertBtAndFindBestMatch()
1664 U32 matchEndIdx = curr + 8; in ZSTD_insertBtAndFindBestMatch()
1665 U32 dummy32; /* to be nullified at the end */ in ZSTD_insertBtAndFindBestMatch()
1671 U32 *const nextPtr = bt + 2 * (matchIndex & btMask); in ZSTD_insertBtAndFindBestMatch()
1688 matchEndIdx = matchIndex + (U32)matchLength; in ZSTD_insertBtAndFindBestMatch()
1689 …estLength)) > (int)(ZSTD_highbit32(curr - matchIndex + 1) - ZSTD_highbit32((U32)offsetPtr[0] + 1))) in ZSTD_insertBtAndFindBestMatch()
1724 …e(ZSTD_CCtx *zc, const BYTE *const ip, const BYTE *const iend, const U32 nbCompares, const U32 mls) in ZSTD_updateTree()
1727 const U32 target = (U32)(ip - base); in ZSTD_updateTree()
1728 U32 idx = zc->nextToUpdate; in ZSTD_updateTree()
1735 …YTE *const ip, const BYTE *const iLimit, size_t *offsetPtr, const U32 maxNbAttempts, const U32 mls) in ZSTD_BtFindBestMatch()
1744 … BYTE *ip, const BYTE *const iLimit, size_t *offsetPtr, const U32 maxNbAttempts, const U32 matchLe… in ZSTD_BtFindBestMatch_selectMLS()
1755 …t(ZSTD_CCtx *zc, const BYTE *const ip, const BYTE *const iend, const U32 nbCompares, const U32 mls) in ZSTD_updateTree_extDict()
1758 const U32 target = (U32)(ip - base); in ZSTD_updateTree_extDict()
1759 U32 idx = zc->nextToUpdate; in ZSTD_updateTree_extDict()
1766 …tx *zc, const BYTE *const ip, const BYTE *const iLimit, size_t *offsetPtr, const U32 maxNbAttempts, in ZSTD_BtFindBestMatch_extDict()
1767 const U32 mls) in ZSTD_BtFindBestMatch_extDict()
1776 const BYTE *ip, const BYTE *const iLimit, size_t *offsetPtr, const U32 maxNbAttempts, in ZSTD_BtFindBestMatch_selectMLS_extDict()
1777 const U32 matchLengthSearch) in ZSTD_BtFindBestMatch_selectMLS_extDict()
1796 U32 ZSTD_insertAndFindFirstIndex(ZSTD_CCtx *zc, const BYTE *ip, U32 mls) in ZSTD_insertAndFindFirstIndex()
1798 U32 *const hashTable = zc->hashTable; in ZSTD_insertAndFindFirstIndex()
1799 const U32 hashLog = zc->params.cParams.hashLog; in ZSTD_insertAndFindFirstIndex()
1800 U32 *const chainTable = zc->chainTable; in ZSTD_insertAndFindFirstIndex()
1801 const U32 chainMask = (1 << zc->params.cParams.chainLog) - 1; in ZSTD_insertAndFindFirstIndex()
1803 const U32 target = (U32)(ip - base); in ZSTD_insertAndFindFirstIndex()
1804 U32 idx = zc->nextToUpdate; in ZSTD_insertAndFindFirstIndex()
1820 …YTE *const ip, const BYTE *const iLimit, size_t *offsetPtr, const U32 maxNbAttempts, const U32 mls, in ZSTD_HcFindBestMatch_generic()
1821 const U32 extDict) in ZSTD_HcFindBestMatch_generic()
1823 U32 *const chainTable = zc->chainTable; in ZSTD_HcFindBestMatch_generic()
1824 const U32 chainSize = (1 << zc->params.cParams.chainLog); in ZSTD_HcFindBestMatch_generic()
1825 const U32 chainMask = chainSize - 1; in ZSTD_HcFindBestMatch_generic()
1828 const U32 dictLimit = zc->dictLimit; in ZSTD_HcFindBestMatch_generic()
1831 const U32 lowLimit = zc->lowLimit; in ZSTD_HcFindBestMatch_generic()
1832 const U32 curr = (U32)(ip - base); in ZSTD_HcFindBestMatch_generic()
1833 const U32 minChain = curr > chainSize ? curr - chainSize : 0; in ZSTD_HcFindBestMatch_generic()
1838 U32 matchIndex = ZSTD_insertAndFindFirstIndex(zc, ip, mls); in ZSTD_HcFindBestMatch_generic()
1869 …STD_CCtx *zc, const BYTE *ip, const BYTE *const iLimit, size_t *offsetPtr, const U32 maxNbAttempts, in ZSTD_HcFindBestMatch_selectMLS()
1870 const U32 matchLengthSearch) in ZSTD_HcFindBestMatch_selectMLS()
1881 …STD_CCtx *zc, const BYTE *ip, const BYTE *const iLimit, size_t *offsetPtr, const U32 maxNbAttempts, in ZSTD_HcFindBestMatch_extDict_selectMLS()
1882 const U32 matchLengthSearch) in ZSTD_HcFindBestMatch_extDict_selectMLS()
1897 …y_generic(ZSTD_CCtx *ctx, const void *src, size_t srcSize, const U32 searchMethod, const U32 depth) in ZSTD_compressBlock_lazy_generic()
1907 U32 const maxSearches = 1 << ctx->params.cParams.searchLog; in ZSTD_compressBlock_lazy_generic()
1908 U32 const mls = ctx->params.cParams.searchLength; in ZSTD_compressBlock_lazy_generic()
1910 …Ctx * zc, const BYTE *ip, const BYTE *iLimit, size_t *offsetPtr, U32 maxNbAttempts, U32 matchLengt… in ZSTD_compressBlock_lazy_generic()
1912 U32 offset_1 = ctx->rep[0], offset_2 = ctx->rep[1], savedOffset = 0; in ZSTD_compressBlock_lazy_generic()
1918 U32 const maxRep = (U32)(ip - base); in ZSTD_compressBlock_lazy_generic()
1959 int const gain1 = (int)(matchLength * 3 - ZSTD_highbit32((U32)offset + 1) + 1); in ZSTD_compressBlock_lazy_generic()
1966 int const gain2 = (int)(ml2 * 4 - ZSTD_highbit32((U32)offset2 + 1)); /* raw approx */ in ZSTD_compressBlock_lazy_generic()
1967 int const gain1 = (int)(matchLength * 4 - ZSTD_highbit32((U32)offset + 1) + 4); in ZSTD_compressBlock_lazy_generic()
1980 int const gain1 = (int)(matchLength * 4 - ZSTD_highbit32((U32)offset + 1) + 1); in ZSTD_compressBlock_lazy_generic()
1987 int const gain2 = (int)(ml2 * 4 - ZSTD_highbit32((U32)offset2 + 1)); /* raw approx */ in ZSTD_compressBlock_lazy_generic()
1988 int const gain1 = (int)(matchLength * 4 - ZSTD_highbit32((U32)offset + 1) + 7); in ZSTD_compressBlock_lazy_generic()
2012 offset_1 = (U32)(offset - ZSTD_REP_MOVE); in ZSTD_compressBlock_lazy_generic()
2019 ZSTD_storeSeq(seqStorePtr, litLength, anchor, (U32)offset, matchLength - MINMATCH); in ZSTD_compressBlock_lazy_generic()
2029 offset_1 = (U32)offset; /* swap repcodes */ in ZSTD_compressBlock_lazy_generic()
2058 …t_generic(ZSTD_CCtx *ctx, const void *src, size_t srcSize, const U32 searchMethod, const U32 depth) in ZSTD_compressBlock_lazy_extDict_generic()
2067 const U32 dictLimit = ctx->dictLimit; in ZSTD_compressBlock_lazy_extDict_generic()
2068 const U32 lowestIndex = ctx->lowLimit; in ZSTD_compressBlock_lazy_extDict_generic()
2074 const U32 maxSearches = 1 << ctx->params.cParams.searchLog; in ZSTD_compressBlock_lazy_extDict_generic()
2075 const U32 mls = ctx->params.cParams.searchLength; in ZSTD_compressBlock_lazy_extDict_generic()
2077 …Ctx * zc, const BYTE *ip, const BYTE *iLimit, size_t *offsetPtr, U32 maxNbAttempts, U32 matchLengt… in ZSTD_compressBlock_lazy_extDict_generic()
2080 U32 offset_1 = ctx->rep[0], offset_2 = ctx->rep[1]; in ZSTD_compressBlock_lazy_extDict_generic()
2091 U32 curr = (U32)(ip - base); in ZSTD_compressBlock_lazy_extDict_generic()
2095 const U32 repIndex = (U32)(curr + 1 - offset_1); in ZSTD_compressBlock_lazy_extDict_generic()
2098 …if (((U32)((dictLimit - 1) - repIndex) >= 3) & (repIndex > lowestIndex)) /* intentional overflow */ in ZSTD_compressBlock_lazy_extDict_generic()
2129 const U32 repIndex = (U32)(curr - offset_1); in ZSTD_compressBlock_lazy_extDict_generic()
2132 …if (((U32)((dictLimit - 1) - repIndex) >= 3) & (repIndex > lowestIndex)) /* intentional overflow */ in ZSTD_compressBlock_lazy_extDict_generic()
2140 int const gain1 = (int)(matchLength * 3 - ZSTD_highbit32((U32)offset + 1) + 1); in ZSTD_compressBlock_lazy_extDict_generic()
2150 int const gain2 = (int)(ml2 * 4 - ZSTD_highbit32((U32)offset2 + 1)); /* raw approx */ in ZSTD_compressBlock_lazy_extDict_generic()
2151 int const gain1 = (int)(matchLength * 4 - ZSTD_highbit32((U32)offset + 1) + 4); in ZSTD_compressBlock_lazy_extDict_generic()
2164 const U32 repIndex = (U32)(curr - offset_1); in ZSTD_compressBlock_lazy_extDict_generic()
2167 …if (((U32)((dictLimit - 1) - repIndex) >= 3) & (repIndex > lowestIndex)) /* intentional overflow */ in ZSTD_compressBlock_lazy_extDict_generic()
2175 int gain1 = (int)(matchLength * 4 - ZSTD_highbit32((U32)offset + 1) + 1); in ZSTD_compressBlock_lazy_extDict_generic()
2185 int const gain2 = (int)(ml2 * 4 - ZSTD_highbit32((U32)offset2 + 1)); /* raw approx */ in ZSTD_compressBlock_lazy_extDict_generic()
2186 int const gain1 = (int)(matchLength * 4 - ZSTD_highbit32((U32)offset + 1) + 7); in ZSTD_compressBlock_lazy_extDict_generic()
2198 U32 const matchIndex = (U32)((start - base) - (offset - ZSTD_REP_MOVE)); in ZSTD_compressBlock_lazy_extDict_generic()
2207 offset_1 = (U32)(offset - ZSTD_REP_MOVE); in ZSTD_compressBlock_lazy_extDict_generic()
2213 ZSTD_storeSeq(seqStorePtr, litLength, anchor, (U32)offset, matchLength - MINMATCH); in ZSTD_compressBlock_lazy_extDict_generic()
2219 const U32 repIndex = (U32)((ip - base) - offset_2); in ZSTD_compressBlock_lazy_extDict_generic()
2222 …if (((U32)((dictLimit - 1) - repIndex) >= 3) & (repIndex > lowestIndex)) /* intentional overflow */ in ZSTD_compressBlock_lazy_extDict_generic()
2230 offset_1 = (U32)offset; /* swap offset history */ in ZSTD_compressBlock_lazy_extDict_generic()
2330 return blockCompressor[extDict][(U32)strat]; in ZSTD_selectBlockCompressor()
2338 const U32 curr = (U32)(istart - base); in ZSTD_compressBlock_internal()
2343 …zc->nextToUpdate = curr - MIN(192, (U32)(curr - zc->nextToUpdate - 384)); /* update tree not updat… in ZSTD_compressBlock_internal()
2355 …STD_CCtx *cctx, void *dst, size_t dstCapacity, const void *src, size_t srcSize, U32 lastFrameChunk) in ZSTD_compress_generic()
2362 U32 const maxDist = 1 << cctx->params.cParams.windowLog; in ZSTD_compress_generic()
2368 U32 const lastBlock = lastFrameChunk & (blockSize >= remaining); in ZSTD_compress_generic()
2378 …U32 const cycleMask = (1 << ZSTD_cycleLog(cctx->params.cParams.hashLog, cctx->params.cParams.strat… in ZSTD_compress_generic()
2379 U32 const curr = (U32)(ip - cctx->base); in ZSTD_compress_generic()
2380 U32 const newCurr = (curr & cycleMask) + (1 << cctx->params.cParams.windowLog); in ZSTD_compress_generic()
2381 U32 const correction = curr - newCurr; in ZSTD_compress_generic()
2394 if ((U32)(ip + blockSize - cctx->base) > cctx->loadedDictEnd + maxDist) { in ZSTD_compress_generic()
2396 U32 const newLowLimit = (U32)(ip + blockSize - cctx->base) - maxDist; in ZSTD_compress_generic()
2408 U32 const cBlockHeader24 = lastBlock + (((U32)bt_raw) << 1) + (U32)(blockSize << 3); in ZSTD_compress_generic()
2415 U32 const cBlockHeader24 = lastBlock + (((U32)bt_compressed) << 1) + (U32)(cSize << 3); in ZSTD_compress_generic()
2431 …eFrameHeader(void *dst, size_t dstCapacity, ZSTD_parameters params, U64 pledgedSrcSize, U32 dictID) in ZSTD_writeFrameHeader()
2434 U32 const dictIDSizeCode = (dictID > 0) + (dictID >= 256) + (dictID >= 65536); /* 0-3 */ in ZSTD_writeFrameHeader()
2435 U32 const checksumFlag = params.fParams.checksumFlag > 0; in ZSTD_writeFrameHeader()
2436 U32 const windowSize = 1U << params.cParams.windowLog; in ZSTD_writeFrameHeader()
2437 U32 const singleSegment = params.fParams.contentSizeFlag && (windowSize >= pledgedSrcSize); in ZSTD_writeFrameHeader()
2439 U32 const fcsCode = in ZSTD_writeFrameHeader()
2479 ZSTD_writeLE32(op + pos, (U32)(pledgedSrcSize)); in ZSTD_writeFrameHeader()
2490 …ctx, void *dst, size_t dstCapacity, const void *src, size_t srcSize, U32 frame, U32 lastFrameChunk) in ZSTD_compressContinue_internal()
2512 cctx->dictLimit = (U32)(cctx->nextSrc - cctx->base); in ZSTD_compressContinue_internal()
2523 …U32 const lowLimitMax = (highInputIdx > (ptrdiff_t)cctx->dictLimit) ? cctx->dictLimit : (U32)highI… in ZSTD_compressContinue_internal()
2564 zc->dictLimit = (U32)(zc->nextSrc - zc->base); in ZSTD_loadDictionaryContent()
2568 zc->loadedDictEnd = zc->forceWindow ? 0 : (U32)(iend - zc->base); in ZSTD_loadDictionaryContent()
2597 zc->nextToUpdate = (U32)(iend - zc->base); in ZSTD_loadDictionaryContent()
2607 U32 s; in ZSTD_checkDictNCount()
2697 U32 offcodeMax = MaxOff; in ZSTD_loadZstdDictionary()
2698 if (dictContentSize <= ((U32)-1) - 128 KB) { in ZSTD_loadZstdDictionary()
2699 …U32 const maxOffset = (U32)dictContentSize + 128 KB; /* The maximum offset that must be supported … in ZSTD_loadZstdDictionary()
2706 U32 u; in ZSTD_loadZstdDictionary()
2786 U32 const cBlockHeader24 = 1 /* last block */ + (((U32)bt_raw) << 1) + 0; in ZSTD_writeEpilogue()
2795 U32 const checksum = (U32)xxh64_digest(&cctx->xxhState); in ZSTD_writeEpilogue()
2965 U32 checksum;
2966 U32 frameEnded;
3131 U32 someMoreWork = 1; in ZSTD_compressStream_generic()
3415 …U32 const tableID = (rSize <= 256 KB) + (rSize <= 128 KB) + (rSize <= 16 KB); /* intentional under… in ZSTD_getCParams()