/* this module contains definitions which must be identical *acrosscompression,decompressionanddictBuilder. *Italsocontainsafewfunctionsusefultoatleast2ofthem
* and which benefit from being inlined */
/* Need to use memmove here since the literal buffer can now be located within thedstbuffer.Incircumstanceswheretheop"catchesup"towherethe literalbufferis,therecanbepartialoverlapsinthiscallonthefinal
copy if the literal is being shifted by less than 16 bytes. */ staticvoid ZSTD_copy16(void* dst, constvoid* src) { #ifdefined(ZSTD_ARCH_ARM_NEON)
vst1q_u8((uint8_t*)dst, vld1q_u8((const uint8_t*)src)); #elifdefined(ZSTD_ARCH_X86_SSE2)
_mm_storeu_si128((__m128i*)dst, _mm_loadu_si128((const __m128i*)src)); #elifdefined(__clang__)
ZSTD_memmove(dst, src, 16); #else /* ZSTD_memmove is not inlined properly by gcc */
BYTE copy16_buf[16];
ZSTD_memcpy(copy16_buf, src, 16);
ZSTD_memcpy(dst, copy16_buf, 16); #endif
} #define COPY16(d,s) do { ZSTD_copy16(d,s); d+=16; s+=16; } while (0)
if (ovtype == ZSTD_overlap_src_before_dst && diff < WILDCOPY_VECLEN) { /* Handle short offset copies. */ do {
COPY8(op, ip);
} while (op < oend);
} else {
assert(diff >= WILDCOPY_VECLEN || diff <= -WILDCOPY_VECLEN); /* Separate out the first COPY16() call because the copy length is *almostcertaintobeshort,sothebrancheshavedifferent *probabilities.Sinceitisalmostcertaintobeshort,onlydo *oneCOPY16()inthefirstcall.Then,dotwocallsperloopsince *atthatpointitismorelikelytohaveahightripcount.
*/
ZSTD_copy16(op, ip);
if (16 >= length) return;
op += 16;
ip += 16; do {
COPY16(op, ip);
COPY16(op, ip);
} while (op < oend);
}
}
/* define "workspace is too large" as this number of times larger than needed */ #define ZSTD_WORKSPACETOOLARGE_FACTOR 3
/* when workspace is continuously too large *duringatleastthisnumberoftimes, *context'smemoryusageisconsideredwasteful, *becauseit'ssizedtohandleaworstcasescenariowhichrarelyhappens.
* In which case, resize it down to free some memory */ #define ZSTD_WORKSPACETOOLARGE_MAXDURATION 128
/* Controls whether the input/output buffer is buffered or stable. */ typedef enum {
ZSTD_bm_buffered = 0, /* Buffer the input/output */
ZSTD_bm_stable = 1/* ZSTD_inBuffer/ZSTD_outBuffer is stable */
} ZSTD_bufferMode_e;
/* ZSTD_invalidateRepCodes() : *ensuresnextcompressionwillnotuserepcodesfrompreviousblock. *Note:onlyworkswithregularvariant;
* do not use with extDict variant ! */ void ZSTD_invalidateRepCodes(ZSTD_CCtx* cctx); /* zstdmt, adaptive_compression (shouldn't get this definition from here) */
typedefstruct {
blockType_e blockType;
U32 lastBlock;
U32 origSize;
} blockProperties_t; /* declared here for decompress and fullbench */
/*! ZSTD_getcBlockSize() :
* Provides the size of compressed block from block header `src` */ /* Used by: decompress, fullbench */
size_t ZSTD_getcBlockSize(constvoid* src, size_t srcSize,
blockProperties_t* bpPtr);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.