Back to zstd 1.4.8, before the massive performance regression

pmeunier
Feb 24, 2023, 2:42 PM
ENGQNLDGWI4JFRTVOVXJYK2ZXXXDWZSWSDQORJIC65AKEIDORZOAC

Dependencies

Change contents

  • replacement in zstd/lib/zstd.h at line 2
    [2.40][2.40:96]()
    * Copyright (c) 2016-2021, Yann Collet, Facebook, Inc.
    [2.40]
    [2.96]
    * Copyright (c) 2016-2020, Yann Collet, Facebook, Inc.
  • replacement in zstd/lib/zstd.h at line 75
    [2.3042][2.3042:3074]()
    #define ZSTD_VERSION_RELEASE 9
    [2.3042]
    [2.3074]
    #define ZSTD_VERSION_RELEASE 8
  • edit in zstd/lib/zstd.h at line 549
    [2.32446][2.32446:32478]()
    * ZSTD_d_refMultipleDDicts
  • replacement in zstd/lib/zstd.h at line 554
    [2.32725][2.32725:32798]()
    ZSTD_d_experimentalParam3=1002,
    ZSTD_d_experimentalParam4=1003
    [2.32725]
    [2.32798]
    ZSTD_d_experimentalParam3=1002
  • replacement in zstd/lib/zstd.h at line 951
    [2.56502][2.56502:56601]()
    * The parameters ignored are labelled as "superseded-by-cdict" in the ZSTD_cParameter enum docs.
    [2.56502]
    [2.56601]
    * The parameters ignored are labled as "superseded-by-cdict" in the ZSTD_cParameter enum docs.
  • edit in zstd/lib/zstd.h at line 1002
    [2.60125][2.60125:60496]()
    *
    * If called with ZSTD_d_refMultipleDDicts enabled, repeated calls of this function
    * will store the DDict references in a table, and the DDict used for decompression
    * will be determined at decompression time, as per the dict ID in the frame.
    * The memory for the table is allocated on the first call to refDDict, and can be
    * freed with ZSTD_freeDCtx().
    *
  • edit in zstd/lib/zstd.h at line 1209
    [2.72065][2.72065:72237]()
    /* Note: this enum controls ZSTD_d_refMultipleDDicts */
    ZSTD_rmd_refSingleDDict = 0,
    ZSTD_rmd_refMultipleDDicts = 1
    } ZSTD_refMultipleDDicts_e;
    typedef enum {
  • replacement in zstd/lib/zstd.h at line 1289
    [2.77178][2.77178:77239]()
    * - if an error occurred: ZSTD_CONTENTSIZE_ERROR
    [2.77178]
    [2.77239]
    * - if an error occured: ZSTD_CONTENTSIZE_ERROR
  • edit in zstd/lib/zstd.h at line 1373
    [2.82417][2.82417:82418]()
  • edit in zstd/lib/zstd.h at line 1374
    [2.82419][2.82419:83361]()
    /*! ZSTD_writeSkippableFrame() :
    * Generates a zstd skippable frame containing data given by src, and writes it to dst buffer.
    *
    * Skippable frames begin with a a 4-byte magic number. There are 16 possible choices of magic number,
    * ranging from ZSTD_MAGIC_SKIPPABLE_START to ZSTD_MAGIC_SKIPPABLE_START+15.
    * As such, the parameter magicVariant controls the exact skippable frame magic number variant used, so
    * the magic number used will be ZSTD_MAGIC_SKIPPABLE_START + magicVariant.
    *
    * Returns an error if destination buffer is not large enough, if the source size is not representable
    * with a 4-byte unsigned int, or if the parameter magicVariant is greater than 15 (and therefore invalid).
    *
    * @return : number of bytes written or a ZSTD error.
    */
    ZSTDLIB_API size_t ZSTD_writeSkippableFrame(void* dst, size_t dstCapacity,
    const void* src, size_t srcSize, unsigned magicVariant);
  • edit in zstd/lib/zstd.h at line 1375
    [2.83362][2.83362:83363]()
  • edit in zstd/lib/zstd.h at line 1516
    [2.92382][2.92382:92383]()
  • edit in zstd/lib/zstd.h at line 1524
    [2.92686][2.92686:92894]()
    ZSTD_customMem customMem);
    ZSTDLIB_API ZSTD_DDict* ZSTD_createDDict_advanced(
    const void* dict, size_t dictSize,
    ZSTD_dictLoadMethod_e dictLoadMethod,
    ZSTD_dictContentType_e dictContentType,
  • edit in zstd/lib/zstd.h at line 1526
    [2.92926]
    [2.92926]
    ZSTDLIB_API ZSTD_DDict* ZSTD_createDDict_advanced(const void* dict, size_t dictSize,
    ZSTD_dictLoadMethod_e dictLoadMethod,
    ZSTD_dictContentType_e dictContentType,
    ZSTD_customMem customMem);
  • replacement in zstd/lib/zstd.h at line 1805
    [2.107207][2.107207:107308]()
    ZSTDLIB_API size_t ZSTD_CCtx_getParameter(const ZSTD_CCtx* cctx, ZSTD_cParameter param, int* value);
    [2.107207]
    [2.107308]
    ZSTDLIB_API size_t ZSTD_CCtx_getParameter(ZSTD_CCtx* cctx, ZSTD_cParameter param, int* value);
  • replacement in zstd/lib/zstd.h at line 1860
    [2.109757][2.109757:109873]()
    ZSTDLIB_API size_t ZSTD_CCtxParams_getParameter(const ZSTD_CCtx_params* params, ZSTD_cParameter param, int* value);
    [2.109757]
    [2.109873]
    ZSTDLIB_API size_t ZSTD_CCtxParams_getParameter(ZSTD_CCtx_params* params, ZSTD_cParameter param, int* value);
  • edit in zstd/lib/zstd.h at line 1985
    [2.116491][2.116491:117584]()
    /* ZSTD_d_refMultipleDDicts
    * Experimental parameter.
    * Default is 0 == disabled. Set to 1 to enable
    *
    * If enabled and dctx is allocated on the heap, then additional memory will be allocated
    * to store references to multiple ZSTD_DDict. That is, multiple calls of ZSTD_refDDict()
    * using a given ZSTD_DCtx, rather than overwriting the previous DDict reference, will instead
    * store all references. At decompression time, the appropriate dictID is selected
    * from the set of DDicts based on the dictID in the frame.
    *
    * Usage is simply calling ZSTD_refDDict() on multiple dict buffers.
    *
    * Param has values of byte ZSTD_refMultipleDDicts_e
    *
    * WARNING: Enabling this parameter and calling ZSTD_DCtx_refDDict(), will trigger memory
    * allocation for the hash table. ZSTD_freeDCtx() also frees this memory.
    * Memory is allocated as per ZSTD_DCtx::customMem.
    *
    * Although this function allocates memory for the table, the user is still responsible for
    * memory management of the underlying ZSTD_DDict* themselves.
    */
    #define ZSTD_d_refMultipleDDicts ZSTD_d_experimentalParam4
  • edit in zstd/lib/zstd.h at line 1986
    [2.117585][2.117585:117586]()
  • replacement in zstd/lib/legacy/zstd_v07.h at line 2
    [2.140962][2.140962:141018]()
    * Copyright (c) 2016-2021, Yann Collet, Facebook, Inc.
    [2.140962]
    [2.141018]
    * Copyright (c) 2016-2020, Yann Collet, Facebook, Inc.
  • replacement in zstd/lib/legacy/zstd_v07.c at line 2
    [2.149722][2.149722:149778]()
    * Copyright (c) 2016-2021, Yann Collet, Facebook, Inc.
    [2.149722]
    [2.149778]
    * Copyright (c) 2016-2020, Yann Collet, Facebook, Inc.
  • replacement in zstd/lib/legacy/zstd_v07.c at line 3261
    [2.281032][2.281032:281077]()
    const BYTE* const in = (const BYTE*)src;
    [2.281032]
    [2.281077]
    const BYTE* const in = (const BYTE* const)src;
  • replacement in zstd/lib/legacy/zstd_v07.c at line 3456
    [2.289159][2.289159:289208]()
    const BYTE* const istart = (const BYTE*)src;
    [2.289159]
    [2.289208]
    const BYTE* const istart = (const BYTE* const)src;
  • replacement in zstd/lib/legacy/zstd_v07.c at line 3675
    [2.298233][2.298233:298270]()
    BYTE* const ostart = (BYTE*)dst;
    [2.298233]
    [2.298270]
    BYTE* const ostart = (BYTE* const)dst;
  • replacement in zstd/lib/legacy/zstd_v07.c at line 3802
    [2.303047][2.303047:303084]()
    BYTE* const ostart = (BYTE*)dst;
    [2.303047]
    [2.303084]
    BYTE* const ostart = (BYTE* const)dst;
  • replacement in zstd/lib/legacy/zstd_v06.h at line 2
    [2.335000][2.335000:335056]()
    * Copyright (c) 2016-2021, Yann Collet, Facebook, Inc.
    [2.335000]
    [2.335056]
    * Copyright (c) 2016-2020, Yann Collet, Facebook, Inc.
  • replacement in zstd/lib/legacy/zstd_v06.c at line 2
    [2.343117][2.343117:343173]()
    * Copyright (c) 2016-2021, Yann Collet, Facebook, Inc.
    [2.343117]
    [2.343173]
    * Copyright (c) 2016-2020, Yann Collet, Facebook, Inc.
  • replacement in zstd/lib/legacy/zstd_v06.c at line 3032
    [2.462719][2.462719:462764]()
    const BYTE* const in = (const BYTE*)src;
    [2.462719]
    [2.462764]
    const BYTE* const in = (const BYTE* const)src;
  • replacement in zstd/lib/legacy/zstd_v06.c at line 3226
    [2.470827][2.470827:470876]()
    const BYTE* const istart = (const BYTE*)src;
    [2.470827]
    [2.470876]
    const BYTE* const istart = (const BYTE* const)src;
  • replacement in zstd/lib/legacy/zstd_v06.c at line 3448
    [2.479991][2.479991:480028]()
    BYTE* const ostart = (BYTE*)dst;
    [2.479991]
    [2.480028]
    BYTE* const ostart = (BYTE* const)dst;
  • replacement in zstd/lib/legacy/zstd_v06.c at line 3564
    [2.484472][2.484472:484509]()
    BYTE* const ostart = (BYTE*)dst;
    [2.484472]
    [2.484509]
    BYTE* const ostart = (BYTE* const)dst;
  • replacement in zstd/lib/legacy/zstd_v05.h at line 2
    [2.509347][2.509347:509403]()
    * Copyright (c) 2016-2021, Yann Collet, Facebook, Inc.
    [2.509347]
    [2.509403]
    * Copyright (c) 2016-2020, Yann Collet, Facebook, Inc.
  • replacement in zstd/lib/legacy/zstd_v05.c at line 2
    [2.516926][2.516926:516982]()
    * Copyright (c) 2016-2021, Yann Collet, Facebook, Inc.
    [2.516926]
    [2.516982]
    * Copyright (c) 2016-2020, Yann Collet, Facebook, Inc.
  • replacement in zstd/lib/legacy/zstd_v05.c at line 2836
    [2.625982][2.625982:626027]()
    const BYTE* const in = (const BYTE*)src;
    [2.625982]
    [2.626027]
    const BYTE* const in = (const BYTE* const)src;
  • replacement in zstd/lib/legacy/zstd_v05.c at line 3005
    [2.632767][2.632767:632816]()
    const BYTE* const istart = (const BYTE*)src;
    [2.632767]
    [2.632816]
    const BYTE* const istart = (const BYTE* const)src;
  • replacement in zstd/lib/legacy/zstd_v05.c at line 3313
    [2.643966][2.643966:644003]()
    BYTE* const ostart = (BYTE*)dst;
    [2.643966]
    [2.644003]
    BYTE* const ostart = (BYTE* const)dst;
  • replacement in zstd/lib/legacy/zstd_v05.c at line 3426
    [2.648143][2.648143:648180]()
    BYTE* const ostart = (BYTE*)dst;
    [2.648143]
    [2.648180]
    BYTE* const ostart = (BYTE* const)dst;
  • replacement in zstd/lib/legacy/zstd_v04.h at line 2
    [2.673529][2.673529:673585]()
    * Copyright (c) 2016-2021, Yann Collet, Facebook, Inc.
    [2.673529]
    [2.673585]
    * Copyright (c) 2016-2020, Yann Collet, Facebook, Inc.
  • replacement in zstd/lib/legacy/zstd_v04.c at line 2
    [2.680010][2.680010:680066]()
    * Copyright (c) 2016-2021, Yann Collet, Facebook, Inc.
    [2.680010]
    [2.680066]
    * Copyright (c) 2016-2020, Yann Collet, Facebook, Inc.
  • replacement in zstd/lib/legacy/zstd_v03.h at line 2
    [2.815473][2.815473:815529]()
    * Copyright (c) 2016-2021, Yann Collet, Facebook, Inc.
    [2.815473]
    [2.815529]
    * Copyright (c) 2016-2020, Yann Collet, Facebook, Inc.
  • replacement in zstd/lib/legacy/zstd_v03.c at line 2
    [2.819236][2.819236:819292]()
    * Copyright (c) 2016-2021, Yann Collet, Facebook, Inc.
    [2.819236]
    [2.819292]
    * Copyright (c) 2016-2020, Yann Collet, Facebook, Inc.
  • replacement in zstd/lib/legacy/zstd_v02.h at line 2
    [2.933586][2.933586:933642]()
    * Copyright (c) 2016-2021, Yann Collet, Facebook, Inc.
    [2.933586]
    [2.933642]
    * Copyright (c) 2016-2020, Yann Collet, Facebook, Inc.
  • replacement in zstd/lib/legacy/zstd_v02.c at line 2
    [2.937337][2.937337:937393]()
    * Copyright (c) 2016-2021, Yann Collet, Facebook, Inc.
    [2.937337]
    [2.937393]
    * Copyright (c) 2016-2020, Yann Collet, Facebook, Inc.
  • replacement in zstd/lib/legacy/zstd_v01.h at line 2
    [2.1065567][2.1065567:1065623]()
    * Copyright (c) 2016-2021, Yann Collet, Facebook, Inc.
    [2.1065567]
    [2.1065623]
    * Copyright (c) 2016-2020, Yann Collet, Facebook, Inc.
  • replacement in zstd/lib/legacy/zstd_v01.c at line 2
    [2.1069409][2.1069409:1069465]()
    * Copyright (c) 2016-2021, Yann Collet, Facebook, Inc.
    [2.1069409]
    [2.1069465]
    * Copyright (c) 2016-2020, Yann Collet, Facebook, Inc.
  • replacement in zstd/lib/legacy/zstd_legacy.h at line 2
    [2.1140966][2.1140966:1141022]()
    * Copyright (c) 2016-2021, Yann Collet, Facebook, Inc.
    [2.1140966]
    [2.1141022]
    * Copyright (c) 2016-2020, Yann Collet, Facebook, Inc.
  • replacement in zstd/lib/decompress/zstd_decompress_internal.h at line 2
    [2.1154940][2.1154940:1154996]()
    * Copyright (c) 2016-2021, Yann Collet, Facebook, Inc.
    [2.1154940]
    [2.1154996]
    * Copyright (c) 2016-2020, Yann Collet, Facebook, Inc.
  • edit in zstd/lib/decompress/zstd_decompress_internal.h at line 24
    [2.1155751][2.1155751:1155810]()
    #include "../common/zstd_trace.h" /* ZSTD_TraceCtx */
  • edit in zstd/lib/decompress/zstd_decompress_internal.h at line 101
    [2.1159424][2.1159424:1159634]()
    /* Hashset for storing references to multiple ZSTD_DDict within ZSTD_DCtx */
    typedef struct {
    const ZSTD_DDict** ddictPtrTable;
    size_t ddictPtrTableSize;
    size_t ddictPtrCount;
    } ZSTD_DDictHashSet;
  • edit in zstd/lib/decompress/zstd_decompress_internal.h at line 116
    [2.1160273][2.1160273:1160297]()
    U64 processedCSize;
  • edit in zstd/lib/decompress/zstd_decompress_internal.h at line 139
    [2.1161490][2.1161490:1161726]()
    ZSTD_DDictHashSet* ddictSet; /* Hash set for multiple ddicts */
    ZSTD_refMultipleDDicts_e refMultipleDDicts; /* User specified: if == 1, will allow references to multiple DDicts. Default == 0 (disabled) */
  • edit in zstd/lib/decompress/zstd_decompress_internal.h at line 168
    [2.1162471][2.1162471:1162540]()
    #endif
    /* Tracing */
    #if ZSTD_TRACE
    ZSTD_TraceCtx traceCtx;
  • replacement in zstd/lib/decompress/zstd_decompress_internal.h at line 187
    [2.1163338][2.1163338:1163415]()
    void ZSTD_checkContinuity(ZSTD_DCtx* dctx, const void* dst, size_t dstSize);
    [2.1163338]
    [2.1163415]
    void ZSTD_checkContinuity(ZSTD_DCtx* dctx, const void* dst);
  • replacement in zstd/lib/decompress/zstd_decompress_block.h at line 2
    [2.1163514][2.1163514:1163570]()
    * Copyright (c) 2016-2021, Yann Collet, Facebook, Inc.
    [2.1163514]
    [2.1163570]
    * Copyright (c) 2016-2020, Yann Collet, Facebook, Inc.
  • replacement in zstd/lib/decompress/zstd_decompress_block.c at line 2
    [2.1165818][2.1165818:1165874]()
    * Copyright (c) 2016-2021, Yann Collet, Facebook, Inc.
    [2.1165818]
    [2.1165874]
    * Copyright (c) 2016-2020, Yann Collet, Facebook, Inc.
  • replacement in zstd/lib/decompress/zstd_decompress_block.c at line 580
    [2.1190508][2.1190508:1190557]()
    const BYTE* const istart = (const BYTE*)src;
    [2.1190508]
    [2.1190557]
    const BYTE* const istart = (const BYTE* const)src;
  • replacement in zstd/lib/decompress/zstd_decompress_block.c at line 1111
    [2.1213723][2.1213723:1213760]()
    BYTE* const ostart = (BYTE*)dst;
    [2.1213723]
    [2.1213760]
    BYTE* const ostart = (BYTE* const)dst;
  • replacement in zstd/lib/decompress/zstd_decompress_block.c at line 1245
    [2.1219938][2.1219938:1219975]()
    BYTE* const ostart = (BYTE*)dst;
    [2.1219938]
    [2.1219975]
    BYTE* const ostart = (BYTE* const)dst;
  • replacement in zstd/lib/decompress/zstd_decompress_block.c at line 1520
    [2.1231831][2.1231831:1231907]()
    void ZSTD_checkContinuity(ZSTD_DCtx* dctx, const void* dst, size_t dstSize)
    [2.1231831]
    [2.1231907]
    void ZSTD_checkContinuity(ZSTD_DCtx* dctx, const void* dst)
  • replacement in zstd/lib/decompress/zstd_decompress_block.c at line 1522
    [2.1231909][2.1231909:1231986]()
    if (dst != dctx->previousDstEnd && dstSize > 0) { /* not contiguous */
    [2.1231909]
    [2.1231986]
    if (dst != dctx->previousDstEnd) { /* not contiguous */
  • replacement in zstd/lib/decompress/zstd_decompress_block.c at line 1536
    [2.1232412][2.1232412:1232462]()
    ZSTD_checkContinuity(dctx, dst, dstCapacity);
    [2.1232412]
    [2.1232462]
    ZSTD_checkContinuity(dctx, dst);
  • replacement in zstd/lib/decompress/zstd_decompress.c at line 2
    [2.1232679][2.1232679:1232735]()
    * Copyright (c) 2016-2021, Yann Collet, Facebook, Inc.
    [2.1232679]
    [2.1232735]
    * Copyright (c) 2016-2020, Yann Collet, Facebook, Inc.
  • edit in zstd/lib/decompress/zstd_decompress.c at line 61
    [2.1234702][2.1234702:1234736]()
    #include "../common/zstd_trace.h"
  • edit in zstd/lib/decompress/zstd_decompress.c at line 65
    [2.1234854][2.1234854:1234937]()
    #include "../common/xxhash.h" /* XXH64_reset, XXH64_update, XXH64_digest, XXH64 */
  • edit in zstd/lib/decompress/zstd_decompress.c at line 73
    [2.1235287][2.1235287:1241096]()
    /*************************************
    * Multiple DDicts Hashset internals *
    *************************************/
    #define DDICT_HASHSET_MAX_LOAD_FACTOR_COUNT_MULT 4
    #define DDICT_HASHSET_MAX_LOAD_FACTOR_SIZE_MULT 3 /* These two constants represent SIZE_MULT/COUNT_MULT load factor without using a float.
    * Currently, that means a 0.75 load factor.
    * So, if count * COUNT_MULT / size * SIZE_MULT != 0, then we've exceeded
    * the load factor of the ddict hash set.
    */
    #define DDICT_HASHSET_TABLE_BASE_SIZE 64
    #define DDICT_HASHSET_RESIZE_FACTOR 2
    /* Hash function to determine starting position of dict insertion within the table
    * Returns an index between [0, hashSet->ddictPtrTableSize]
    */
    static size_t ZSTD_DDictHashSet_getIndex(const ZSTD_DDictHashSet* hashSet, U32 dictID) {
    const U64 hash = XXH64(&dictID, sizeof(U32), 0);
    /* DDict ptr table size is a multiple of 2, use size - 1 as mask to get index within [0, hashSet->ddictPtrTableSize) */
    return hash & (hashSet->ddictPtrTableSize - 1);
    }
    /* Adds DDict to a hashset without resizing it.
    * If inserting a DDict with a dictID that already exists in the set, replaces the one in the set.
    * Returns 0 if successful, or a zstd error code if something went wrong.
    */
    static size_t ZSTD_DDictHashSet_emplaceDDict(ZSTD_DDictHashSet* hashSet, const ZSTD_DDict* ddict) {
    const U32 dictID = ZSTD_getDictID_fromDDict(ddict);
    size_t idx = ZSTD_DDictHashSet_getIndex(hashSet, dictID);
    const size_t idxRangeMask = hashSet->ddictPtrTableSize - 1;
    RETURN_ERROR_IF(hashSet->ddictPtrCount == hashSet->ddictPtrTableSize, GENERIC, "Hash set is full!");
    DEBUGLOG(4, "Hashed index: for dictID: %u is %zu", dictID, idx);
    while (hashSet->ddictPtrTable[idx] != NULL) {
    /* Replace existing ddict if inserting ddict with same dictID */
    if (ZSTD_getDictID_fromDDict(hashSet->ddictPtrTable[idx]) == dictID) {
    DEBUGLOG(4, "DictID already exists, replacing rather than adding");
    hashSet->ddictPtrTable[idx] = ddict;
    return 0;
    }
    idx &= idxRangeMask;
    idx++;
    }
    DEBUGLOG(4, "Final idx after probing for dictID %u is: %zu", dictID, idx);
    hashSet->ddictPtrTable[idx] = ddict;
    hashSet->ddictPtrCount++;
    return 0;
    }
    /* Expands hash table by factor of DDICT_HASHSET_RESIZE_FACTOR and
    * rehashes all values, allocates new table, frees old table.
    * Returns 0 on success, otherwise a zstd error code.
    */
    static size_t ZSTD_DDictHashSet_expand(ZSTD_DDictHashSet* hashSet, ZSTD_customMem customMem) {
    size_t newTableSize = hashSet->ddictPtrTableSize * DDICT_HASHSET_RESIZE_FACTOR;
    const ZSTD_DDict** newTable = (const ZSTD_DDict**)ZSTD_customCalloc(sizeof(ZSTD_DDict*) * newTableSize, customMem);
    const ZSTD_DDict** oldTable = hashSet->ddictPtrTable;
    size_t oldTableSize = hashSet->ddictPtrTableSize;
    size_t i;
    DEBUGLOG(4, "Expanding DDict hash table! Old size: %zu new size: %zu", oldTableSize, newTableSize);
    RETURN_ERROR_IF(!newTable, memory_allocation, "Expanded hashset allocation failed!");
    hashSet->ddictPtrTable = newTable;
    hashSet->ddictPtrTableSize = newTableSize;
    hashSet->ddictPtrCount = 0;
    for (i = 0; i < oldTableSize; ++i) {
    if (oldTable[i] != NULL) {
    FORWARD_IF_ERROR(ZSTD_DDictHashSet_emplaceDDict(hashSet, oldTable[i]), "");
    }
    }
    ZSTD_customFree((void*)oldTable, customMem);
    DEBUGLOG(4, "Finished re-hash");
    return 0;
    }
    /* Fetches a DDict with the given dictID
    * Returns the ZSTD_DDict* with the requested dictID. If it doesn't exist, then returns NULL.
    */
    static const ZSTD_DDict* ZSTD_DDictHashSet_getDDict(ZSTD_DDictHashSet* hashSet, U32 dictID) {
    size_t idx = ZSTD_DDictHashSet_getIndex(hashSet, dictID);
    const size_t idxRangeMask = hashSet->ddictPtrTableSize - 1;
    DEBUGLOG(4, "Hashed index: for dictID: %u is %zu", dictID, idx);
    for (;;) {
    size_t currDictID = ZSTD_getDictID_fromDDict(hashSet->ddictPtrTable[idx]);
    if (currDictID == dictID || currDictID == 0) {
    /* currDictID == 0 implies a NULL ddict entry */
    break;
    } else {
    idx &= idxRangeMask; /* Goes to start of table when we reach the end */
    idx++;
    }
    }
    DEBUGLOG(4, "Final idx after probing for dictID %u is: %zu", dictID, idx);
    return hashSet->ddictPtrTable[idx];
    }
    /* Allocates space for and returns a ddict hash set
    * The hash set's ZSTD_DDict* table has all values automatically set to NULL to begin with.
    * Returns NULL if allocation failed.
    */
    static ZSTD_DDictHashSet* ZSTD_createDDictHashSet(ZSTD_customMem customMem) {
    ZSTD_DDictHashSet* ret = (ZSTD_DDictHashSet*)ZSTD_customMalloc(sizeof(ZSTD_DDictHashSet), customMem);
    DEBUGLOG(4, "Allocating new hash set");
    ret->ddictPtrTable = (const ZSTD_DDict**)ZSTD_customCalloc(DDICT_HASHSET_TABLE_BASE_SIZE * sizeof(ZSTD_DDict*), customMem);
    ret->ddictPtrTableSize = DDICT_HASHSET_TABLE_BASE_SIZE;
    ret->ddictPtrCount = 0;
    if (!ret || !ret->ddictPtrTable) {
    return NULL;
    }
    return ret;
    }
    /* Frees the table of ZSTD_DDict* within a hashset, then frees the hashset itself.
    * Note: The ZSTD_DDict* within the table are NOT freed.
    */
    static void ZSTD_freeDDictHashSet(ZSTD_DDictHashSet* hashSet, ZSTD_customMem customMem) {
    DEBUGLOG(4, "Freeing ddict hash set");
    if (hashSet && hashSet->ddictPtrTable) {
    ZSTD_customFree((void*)hashSet->ddictPtrTable, customMem);
    }
    if (hashSet) {
    ZSTD_customFree(hashSet, customMem);
    }
    }
  • edit in zstd/lib/decompress/zstd_decompress.c at line 74
    [2.1241097][2.1241097:1241865]()
    /* Public function: Adds a DDict into the ZSTD_DDictHashSet, possibly triggering a resize of the hash set.
    * Returns 0 on success, or a ZSTD error.
    */
    static size_t ZSTD_DDictHashSet_addDDict(ZSTD_DDictHashSet* hashSet, const ZSTD_DDict* ddict, ZSTD_customMem customMem) {
    DEBUGLOG(4, "Adding dict ID: %u to hashset with - Count: %zu Tablesize: %zu", ZSTD_getDictID_fromDDict(ddict), hashSet->ddictPtrCount, hashSet->ddictPtrTableSize);
    if (hashSet->ddictPtrCount * DDICT_HASHSET_MAX_LOAD_FACTOR_COUNT_MULT / hashSet->ddictPtrTableSize * DDICT_HASHSET_MAX_LOAD_FACTOR_SIZE_MULT != 0) {
    FORWARD_IF_ERROR(ZSTD_DDictHashSet_expand(hashSet, customMem), "");
    }
    FORWARD_IF_ERROR(ZSTD_DDictHashSet_emplaceDDict(hashSet, ddict), "");
    return 0;
    }
  • edit in zstd/lib/decompress/zstd_decompress.c at line 104
    [2.1242935][2.1242935:1242990]()
    dctx->refMultipleDDicts = ZSTD_rmd_refSingleDDict;
  • edit in zstd/lib/decompress/zstd_decompress.c at line 123
    [2.1243529][2.1243529:1243556]()
    dctx->ddictSet = NULL;
  • edit in zstd/lib/decompress/zstd_decompress.c at line 124
    [2.1243593]
    [2.1243593]
    dctx->validateChecksum = 1;
  • edit in zstd/lib/decompress/zstd_decompress.c at line 181
    [2.1245298][2.1245298:1245430]()
    if (dctx->ddictSet) {
    ZSTD_freeDDictHashSet(dctx->ddictSet, cMem);
    dctx->ddictSet = NULL;
    }
  • edit in zstd/lib/decompress/zstd_decompress.c at line 191
    [2.1245740][2.1245740:1246746]()
    }
    /* Given a dctx with a digested frame params, re-selects the correct ZSTD_DDict based on
    * the requested dict ID from the frame. If there exists a reference to the correct ZSTD_DDict, then
    * accordingly sets the ddict to be used to decompress the frame.
    *
    * If no DDict is found, then no action is taken, and the ZSTD_DCtx::ddict remains as-is.
    *
    * ZSTD_d_refMultipleDDicts must be enabled for this function to be called.
    */
    static void ZSTD_DCtx_selectFrameDDict(ZSTD_DCtx* dctx) {
    assert(dctx->refMultipleDDicts && dctx->ddictSet);
    DEBUGLOG(4, "Adjusting DDict based on requested dict ID from frame");
    if (dctx->ddict) {
    const ZSTD_DDict* frameDDict = ZSTD_DDictHashSet_getDDict(dctx->ddictSet, dctx->fParams.dictID);
    if (frameDDict) {
    DEBUGLOG(4, "DDict found!");
    ZSTD_clearDict(dctx);
    dctx->dictID = dctx->fParams.dictID;
    dctx->ddict = frameDDict;
    dctx->dictUses = ZSTD_use_indefinitely;
    }
    }
  • edit in zstd/lib/decompress/zstd_decompress.c at line 444
    [2.1257122][2.1257122:1257210]()
    * If multiple DDict references are enabled, also will choose the correct DDict to use.
  • edit in zstd/lib/decompress/zstd_decompress.c at line 450
    [2.1257635][2.1257635:1257848]()
    /* Reference DDict requested by frame if dctx references multiple ddicts */
    if (dctx->refMultipleDDicts == ZSTD_rmd_refMultipleDDicts && dctx->ddictSet) {
    ZSTD_DCtx_selectFrameDDict(dctx);
    }
  • edit in zstd/lib/decompress/zstd_decompress.c at line 459
    [2.1258290][2.1258290:1258330]()
    dctx->processedCSize += headerSize;
  • replacement in zstd/lib/decompress/zstd_decompress.c at line 581
    [2.1262954][2.1262954:1263009]()
    ZSTD_checkContinuity(dctx, blockStart, blockSize);
    [2.1262954]
    [2.1263009]
    ZSTD_checkContinuity(dctx, blockStart);
  • edit in zstd/lib/decompress/zstd_decompress.c at line 613
    [2.1263883][2.1263883:1264745]()
    static void ZSTD_DCtx_trace_end(ZSTD_DCtx const* dctx, U64 uncompressedSize, U64 compressedSize, unsigned streaming)
    {
    #if ZSTD_TRACE
    if (dctx->traceCtx) {
    ZSTD_Trace trace;
    ZSTD_memset(&trace, 0, sizeof(trace));
    trace.version = ZSTD_VERSION_NUMBER;
    trace.streaming = streaming;
    if (dctx->ddict) {
    trace.dictionaryID = ZSTD_getDictID_fromDDict(dctx->ddict);
    trace.dictionarySize = ZSTD_DDict_dictSize(dctx->ddict);
    trace.dictionaryIsCold = dctx->ddictIsCold;
    }
    trace.uncompressedSize = (size_t)uncompressedSize;
    trace.compressedSize = (size_t)compressedSize;
    trace.dctx = dctx;
    ZSTD_trace_decompress_end(dctx->traceCtx, &trace);
    }
    #else
    (void)dctx;
    (void)uncompressedSize;
    (void)compressedSize;
    (void)streaming;
    #endif
    }
  • replacement in zstd/lib/decompress/zstd_decompress.c at line 622
    [2.1265090][2.1265090:1265211]()
    const BYTE* const istart = (const BYTE*)(*srcPtr);
    const BYTE* ip = istart;
    BYTE* const ostart = (BYTE*)dst;
    [2.1265090]
    [2.1265211]
    const BYTE* ip = (const BYTE*)(*srcPtr);
    BYTE* const ostart = (BYTE* const)dst;
  • replacement in zstd/lib/decompress/zstd_decompress.c at line 698
    [2.1268161][2.1268161:1268247]()
    ZSTD_DCtx_trace_end(dctx, (U64)(op-ostart), (U64)(ip-istart), /* streaming */ 0);
    [2.1268161]
    [2.1268247]
  • replacement in zstd/lib/decompress/zstd_decompress.c at line 767
    [2.1270959][2.1270959:1271013]()
    ZSTD_checkContinuity(dctx, dst, dstCapacity);
    [2.1270959]
    [2.1271013]
    ZSTD_checkContinuity(dctx, dst);
  • replacement in zstd/lib/decompress/zstd_decompress.c at line 902
    [2.1276073][2.1276073:1276161]()
    ZSTD_checkContinuity(dctx, dst, dstCapacity);
    dctx->processedCSize += srcSize;
    [2.1276073]
    [2.1276161]
    if (dstCapacity) ZSTD_checkContinuity(dctx, dst);
  • edit in zstd/lib/decompress/zstd_decompress.c at line 1007
    [2.1281212][2.1281212:1281319]()
    ZSTD_DCtx_trace_end(dctx, dctx->decodedSize, dctx->processedCSize, /* streaming */ 1);
  • edit in zstd/lib/decompress/zstd_decompress.c at line 1026
    [2.1282125][2.1282125:1282224]()
    ZSTD_DCtx_trace_end(dctx, dctx->decodedSize, dctx->processedCSize, /* streaming */ 1);
  • edit in zstd/lib/decompress/zstd_decompress.c at line 1179
    [2.1289447][2.1289447:1289525]()
    #if ZSTD_TRACE
    dctx->traceCtx = ZSTD_trace_decompress_begin(dctx);
    #endif
  • edit in zstd/lib/decompress/zstd_decompress.c at line 1181
    [2.1289672][2.1289672:1289702]()
    dctx->processedCSize = 0;
  • edit in zstd/lib/decompress/zstd_decompress.c at line 1394
    [2.1297629][2.1297629:1298203]()
    if (dctx->refMultipleDDicts == ZSTD_rmd_refMultipleDDicts) {
    if (dctx->ddictSet == NULL) {
    dctx->ddictSet = ZSTD_createDDictHashSet(dctx->customMem);
    if (!dctx->ddictSet) {
    RETURN_ERROR(memory_allocation, "Failed to allocate memory for hash set!");
    }
    }
    assert(!dctx->staticSize); /* Impossible: ddictSet cannot have been allocated if static dctx */
    FORWARD_IF_ERROR(ZSTD_DDictHashSet_addDDict(dctx->ddictSet, ddict, dctx->customMem), "");
    }
  • edit in zstd/lib/decompress/zstd_decompress.c at line 1439
    [2.1299946][2.1299946:1300139]()
    case ZSTD_d_refMultipleDDicts:
    bounds.lowerBound = (int)ZSTD_rmd_refSingleDDict;
    bounds.upperBound = (int)ZSTD_rmd_refMultipleDDicts;
    return bounds;
  • edit in zstd/lib/decompress/zstd_decompress.c at line 1475
    [2.1301266][2.1301266:1301378]()
    return 0;
    case ZSTD_d_refMultipleDDicts:
    *value = (int)dctx->refMultipleDDicts;
  • edit in zstd/lib/decompress/zstd_decompress.c at line 1502
    [2.1302405][2.1302405:1302754]()
    case ZSTD_d_refMultipleDDicts:
    CHECK_DBOUNDS(ZSTD_d_refMultipleDDicts, value);
    if (dctx->staticSize != 0) {
    RETURN_ERROR(parameter_unsupported, "Static dctx does not support multiple DDicts!");
    }
    dctx->refMultipleDDicts = (ZSTD_refMultipleDDicts_e)value;
    return 0;
  • edit in zstd/lib/decompress/zstd_decompress.c at line 1683
    [2.1310206][2.1310206:1310340]()
    if (zds->refMultipleDDicts && zds->ddictSet) {
    ZSTD_DCtx_selectFrameDDict(zds);
    }
  • replacement in zstd/lib/decompress/zstd_ddict.h at line 2
    [2.1323944][2.1323944:1324000]()
    * Copyright (c) 2016-2021, Yann Collet, Facebook, Inc.
    [2.1323944]
    [2.1324000]
    * Copyright (c) 2016-2020, Yann Collet, Facebook, Inc.
  • replacement in zstd/lib/decompress/zstd_ddict.c at line 2
    [2.1325305][2.1325305:1325361]()
    * Copyright (c) 2016-2021, Yann Collet, Facebook, Inc.
    [2.1325305]
    [2.1325361]
    * Copyright (c) 2016-2020, Yann Collet, Facebook, Inc.
  • replacement in zstd/lib/decompress/huf_decompress.c at line 4
    [2.1334642][2.1334642:1334698]()
    * Copyright (c) 2013-2021, Yann Collet, Facebook, Inc.
    [2.1334642]
    [2.1334698]
    * Copyright (c) 2013-2020, Yann Collet, Facebook, Inc.
  • replacement in zstd/lib/compress/zstdmt_compress.h at line 2
    [2.1389557][2.1389557:1389613]()
    * Copyright (c) 2016-2021, Yann Collet, Facebook, Inc.
    [2.1389557]
    [2.1389613]
    * Copyright (c) 2016-2020, Yann Collet, Facebook, Inc.
  • replacement in zstd/lib/compress/zstdmt_compress.c at line 2
    [2.1393888][2.1393888:1393944]()
    * Copyright (c) 2016-2021, Yann Collet, Facebook, Inc.
    [2.1393888]
    [2.1393944]
    * Copyright (c) 2016-2020, Yann Collet, Facebook, Inc.
  • edit in zstd/lib/compress/zstdmt_compress.c at line 475
    [2.1411054]
    [2.1411054]
    serialState->ldmState.hashPower =
    ZSTD_rollingHash_primePower(params.ldmParams.minMatchLength);
  • edit in zstd/lib/compress/zstdmt_compress.c at line 489
    [2.1411587]
    [2.1411587]
    size_t const bucketSize = (size_t)1 << bucketLog;
  • edit in zstd/lib/compress/zstdmt_compress.c at line 493
    [2.1411735][2.1411735:1411793]()
    size_t const numBuckets = (size_t)1 << bucketLog;
  • replacement in zstd/lib/compress/zstdmt_compress.c at line 504
    [2.1412500][2.1412500:1412594]()
    serialState->ldmState.bucketOffsets = (BYTE*)ZSTD_customMalloc(numBuckets, cMem);
    [2.1412500]
    [2.1412594]
    serialState->ldmState.bucketOffsets = (BYTE*)ZSTD_customMalloc(bucketSize, cMem);
  • replacement in zstd/lib/compress/zstdmt_compress.c at line 510
    [2.1412809][2.1412809:1412882]()
    ZSTD_memset(serialState->ldmState.bucketOffsets, 0, numBuckets);
    [2.1412809]
    [2.1412882]
    ZSTD_memset(serialState->ldmState.bucketOffsets, 0, bucketSize);
  • edit in zstd/lib/compress/zstdmt_compress.c at line 686
    [2.1421406][2.1421406:1421469]()
    /* Correct nbWorkers to 0. */
    jobParams.nbWorkers = 0;
  • edit in zstd/lib/compress/zstdmt_compress.c at line 753
    [2.1425369][2.1425369:1425399]()
    ZSTD_CCtx_trace(cctx, 0);
  • replacement in zstd/lib/compress/zstd_opt.h at line 2
    [2.1472146][2.1472146:1472202]()
    * Copyright (c) 2016-2021, Yann Collet, Facebook, Inc.
    [2.1472146]
    [2.1472202]
    * Copyright (c) 2016-2020, Yann Collet, Facebook, Inc.
  • replacement in zstd/lib/compress/zstd_opt.c at line 2
    [2.1474197][2.1474197:1474275]()
    * Copyright (c) 2016-2021, Przemyslaw Skibinski, Yann Collet, Facebook, Inc.
    [2.1474197]
    [2.1474275]
    * Copyright (c) 2016-2020, Przemyslaw Skibinski, Yann Collet, Facebook, Inc.
  • replacement in zstd/lib/compress/zstd_ldm.h at line 2
    [2.1542801][2.1542801:1542857]()
    * Copyright (c) 2016-2021, Yann Collet, Facebook, Inc.
    [2.1542801]
    [2.1542857]
    * Copyright (c) 2016-2020, Yann Collet, Facebook, Inc.
  • replacement in zstd/lib/compress/zstd_ldm.h at line 76
    [2.1545724][2.1545724:1545799]()
    * Must be called for data that is not passed to ZSTD_ldm_blockCompress().
    [2.1545724]
    [2.1545799]
    * Must be called for data with is not passed to ZSTD_ldm_blockCompress().
  • replacement in zstd/lib/compress/zstd_ldm.c at line 2
    [2.1547239][2.1547239:1547295]()
    * Copyright (c) 2016-2021, Yann Collet, Facebook, Inc.
    [2.1547239]
    [2.1547295]
    * Copyright (c) 2016-2020, Yann Collet, Facebook, Inc.
  • edit in zstd/lib/compress/zstd_ldm.c at line 14
    [2.1547674][2.1547674:1547704]()
    #include "../common/xxhash.h"
  • edit in zstd/lib/compress/zstd_ldm.c at line 16
    [2.1547828][2.1547828:1547858]()
    #include "zstd_ldm_geartab.h"
  • replacement in zstd/lib/compress/zstd_ldm.c at line 20
    [2.1547945][2.1547945:1550528]()
    typedef struct {
    U64 rolling;
    U64 stopMask;
    } ldmRollingHashState_t;
    /** ZSTD_ldm_gear_init():
    *
    * Initializes the rolling hash state such that it will honor the
    * settings in params. */
    static void ZSTD_ldm_gear_init(ldmRollingHashState_t* state, ldmParams_t const* params)
    {
    unsigned maxBitsInMask = MIN(params->minMatchLength, 64);
    unsigned hashRateLog = params->hashRateLog;
    state->rolling = ~(U32)0;
    /* The choice of the splitting criterion is subject to two conditions:
    * 1. it has to trigger on average every 2^(hashRateLog) bytes;
    * 2. ideally, it has to depend on a window of minMatchLength bytes.
    *
    * In the gear hash algorithm, bit n depends on the last n bytes;
    * so in order to obtain a good quality splitting criterion it is
    * preferable to use bits with high weight.
    *
    * To match condition 1 we use a mask with hashRateLog bits set
    * and, because of the previous remark, we make sure these bits
    * have the highest possible weight while still respecting
    * condition 2.
    */
    if (hashRateLog > 0 && hashRateLog <= maxBitsInMask) {
    state->stopMask = (((U64)1 << hashRateLog) - 1) << (maxBitsInMask - hashRateLog);
    } else {
    /* In this degenerate case we simply honor the hash rate. */
    state->stopMask = ((U64)1 << hashRateLog) - 1;
    }
    }
    /** ZSTD_ldm_gear_feed():
    *
    * Registers in the splits array all the split points found in the first
    * size bytes following the data pointer. This function terminates when
    * either all the data has been processed or LDM_BATCH_SIZE splits are
    * present in the splits array.
    *
    * Precondition: The splits array must not be full.
    * Returns: The number of bytes processed. */
    static size_t ZSTD_ldm_gear_feed(ldmRollingHashState_t* state,
    BYTE const* data, size_t size,
    size_t* splits, unsigned* numSplits)
    {
    size_t n;
    U64 hash, mask;
    hash = state->rolling;
    mask = state->stopMask;
    n = 0;
    #define GEAR_ITER_ONCE() do { \
    hash = (hash << 1) + ZSTD_ldm_gearTab[data[n] & 0xff]; \
    n += 1; \
    if (UNLIKELY((hash & mask) == 0)) { \
    splits[*numSplits] = n; \
    *numSplits += 1; \
    if (*numSplits == LDM_BATCH_SIZE) \
    goto done; \
    } \
    } while (0)
    while (n + 3 < size) {
    GEAR_ITER_ONCE();
    GEAR_ITER_ONCE();
    GEAR_ITER_ONCE();
    GEAR_ITER_ONCE();
    }
    while (n < size) {
    GEAR_ITER_ONCE();
    }
    [2.1547945]
    [2.1550528]
    #define LDM_HASH_CHAR_OFFSET 10
  • edit in zstd/lib/compress/zstd_ldm.c at line 22
    [2.1550529][2.1550529:1550602]()
    #undef GEAR_ITER_ONCE
    done:
    state->rolling = hash;
    return n;
    }
  • edit in zstd/lib/compress/zstd_ldm.c at line 55
    [2.1552140]
    [2.1552140]
    }
    /** ZSTD_ldm_getSmallHash() :
    * numBits should be <= 32
    * If numBits==0, returns 0.
    * @return : the most significant numBits of value. */
    static U32 ZSTD_ldm_getSmallHash(U64 value, U32 numBits)
    {
    assert(numBits <= 32);
    return numBits == 0 ? 0 : (U32)(value >> (64 - numBits));
    }
    /** ZSTD_ldm_getChecksum() :
    * numBitsToDiscard should be <= 32
    * @return : the next most significant 32 bits after numBitsToDiscard */
    static U32 ZSTD_ldm_getChecksum(U64 hash, U32 numBitsToDiscard)
    {
    assert(numBitsToDiscard <= 32);
    return (hash >> (64 - 32 - numBitsToDiscard)) & 0xFFFFFFFF;
    }
    /** ZSTD_ldm_getTag() ;
    * Given the hash, returns the most significant numTagBits bits
    * after (32 + hbits) bits.
    *
    * If there are not enough bits remaining, return the last
    * numTagBits bits. */
    static U32 ZSTD_ldm_getTag(U64 hash, U32 hbits, U32 numTagBits)
    {
    assert(numTagBits < 32 && hbits <= 32);
    if (32 - hbits < numTagBits) {
    return hash & (((U32)1 << numTagBits) - 1);
    } else {
    return (hash >> (32 - hbits - numTagBits)) & (((U32)1 << numTagBits) - 1);
    }
  • replacement in zstd/lib/compress/zstd_ldm.c at line 106
    [2.1552720][2.1552720:1552965]()
    BYTE* const pOffset = ldmState->bucketOffsets + hash;
    unsigned const offset = *pOffset;
    *(ZSTD_ldm_getBucket(ldmState, hash, ldmParams) + offset) = entry;
    *pOffset = (BYTE)((offset + 1) & ((1u << ldmParams.bucketSizeLog) - 1));
    [2.1552720]
    [2.1552965]
    BYTE* const bucketOffsets = ldmState->bucketOffsets;
    *(ZSTD_ldm_getBucket(ldmState, hash, ldmParams) + bucketOffsets[hash]) = entry;
    bucketOffsets[hash]++;
    bucketOffsets[hash] &= ((U32)1 << ldmParams.bucketSizeLog) - 1;
    }
  • edit in zstd/lib/compress/zstd_ldm.c at line 112
    [2.1552966]
    [2.1552966]
    /** ZSTD_ldm_makeEntryAndInsertByTag() :
    *
    * Gets the small hash, checksum, and tag from the rollingHash.
    *
    * If the tag matches (1 << ldmParams.hashRateLog)-1, then
    * creates an ldmEntry from the offset, and inserts it into the hash table.
    *
    * hBits is the length of the small hash, which is the most significant hBits
    * of rollingHash. The checksum is the next 32 most significant bits, followed
    * by ldmParams.hashRateLog bits that make up the tag. */
    static void ZSTD_ldm_makeEntryAndInsertByTag(ldmState_t* ldmState,
    U64 const rollingHash,
    U32 const hBits,
    U32 const offset,
    ldmParams_t const ldmParams)
    {
    U32 const tag = ZSTD_ldm_getTag(rollingHash, hBits, ldmParams.hashRateLog);
    U32 const tagMask = ((U32)1 << ldmParams.hashRateLog) - 1;
    if (tag == tagMask) {
    U32 const hash = ZSTD_ldm_getSmallHash(rollingHash, hBits);
    U32 const checksum = ZSTD_ldm_getChecksum(rollingHash, hBits);
    ldmEntry_t entry;
    entry.offset = offset;
    entry.checksum = checksum;
    ZSTD_ldm_insertEntry(ldmState, hash, entry, ldmParams);
    }
  • edit in zstd/lib/compress/zstd_ldm.c at line 213
    [2.1555519]
    [2.1555519]
    }
    /** ZSTD_ldm_fillLdmHashTable() :
    *
    * Fills hashTable from (lastHashed + 1) to iend (non-inclusive).
    * lastHash is the rolling hash that corresponds to lastHashed.
    *
    * Returns the rolling hash corresponding to position iend-1. */
    static U64 ZSTD_ldm_fillLdmHashTable(ldmState_t* state,
    U64 lastHash, const BYTE* lastHashed,
    const BYTE* iend, const BYTE* base,
    U32 hBits, ldmParams_t const ldmParams)
    {
    U64 rollingHash = lastHash;
    const BYTE* cur = lastHashed + 1;
    while (cur < iend) {
    rollingHash = ZSTD_rollingHash_rotate(rollingHash, cur[-1],
    cur[ldmParams.minMatchLength-1],
    state->hashPower);
    ZSTD_ldm_makeEntryAndInsertByTag(state,
    rollingHash, hBits,
    (U32)(cur - base), ldmParams);
    ++cur;
    }
    return rollingHash;
  • replacement in zstd/lib/compress/zstd_ldm.c at line 242
    [2.1555551][2.1555551:1555601]()
    ldmState_t* ldmState, const BYTE* ip,
    [2.1555551]
    [2.1555601]
    ldmState_t* state, const BYTE* ip,
  • edit in zstd/lib/compress/zstd_ldm.c at line 245
    [2.1555660][2.1555660:1555978]()
    U32 const minMatchLength = params->minMatchLength;
    U32 const hBits = params->hashLog - params->bucketSizeLog;
    BYTE const* const base = ldmState->window.base;
    BYTE const* const istart = ip;
    ldmRollingHashState_t hashState;
    size_t* const splits = ldmState->splitIndices;
    unsigned numSplits;
  • replacement in zstd/lib/compress/zstd_ldm.c at line 246
    [2.1556021][2.1556021:1556828]()
    ZSTD_ldm_gear_init(&hashState, params);
    while (ip < iend) {
    size_t hashed;
    unsigned n;
    numSplits = 0;
    hashed = ZSTD_ldm_gear_feed(&hashState, ip, iend - ip, splits, &numSplits);
    for (n = 0; n < numSplits; n++) {
    if (ip + splits[n] >= istart + minMatchLength) {
    BYTE const* const split = ip + splits[n] - minMatchLength;
    U64 const xxhash = XXH64(split, minMatchLength, 0);
    U32 const hash = (U32)(xxhash & (((U32)1 << hBits) - 1));
    ldmEntry_t entry;
    entry.offset = (U32)(split - base);
    entry.checksum = (U32)(xxhash >> 32);
    ZSTD_ldm_insertEntry(ldmState, hash, entry, *params);
    }
    }
    ip += hashed;
    [2.1556021]
    [2.1556828]
    if ((size_t)(iend - ip) >= params->minMatchLength) {
    U64 startingHash = ZSTD_rollingHash_compute(ip, params->minMatchLength);
    ZSTD_ldm_fillLdmHashTable(
    state, startingHash, ip, iend - params->minMatchLength, state->window.base,
    params->hashLog - params->bucketSizeLog,
    *params);
  • replacement in zstd/lib/compress/zstd_ldm.c at line 277
    [2.1557636][2.1557636:1557695]()
    U32 const entsPerBucket = 1U << params->bucketSizeLog;
    [2.1557636]
    [2.1557695]
    U64 const hashPower = ldmState->hashPower;
  • edit in zstd/lib/compress/zstd_ldm.c at line 279
    [2.1557758]
    [2.1557758]
    U32 const ldmBucketSize = 1U << params->bucketSizeLog;
    U32 const hashRateLog = params->hashRateLog;
    U32 const ldmTagMask = (1U << params->hashRateLog) - 1;
  • replacement in zstd/lib/compress/zstd_ldm.c at line 293
    [2.1558378][2.1558378:1558432]()
    BYTE const* const ilimit = iend - HASH_READ_SIZE;
    [2.1558378]
    [2.1558432]
    BYTE const* const ilimit = iend - MAX(minMatchLength, HASH_READ_SIZE);
  • replacement in zstd/lib/compress/zstd_ldm.c at line 297
    [2.1558520][2.1558520:1558989]()
    /* Rolling hash state */
    ldmRollingHashState_t hashState;
    /* Arrays for staged-processing */
    size_t* const splits = ldmState->splitIndices;
    ldmMatchCandidate_t* const candidates = ldmState->matchCandidates;
    unsigned numSplits;
    if (srcSize < minMatchLength)
    return iend - anchor;
    /* Initialize the rolling hash state with the first minMatchLength bytes */
    ZSTD_ldm_gear_init(&hashState, params);
    {
    size_t n = 0;
    [2.1558520]
    [2.1558989]
    /* Rolling hash */
    BYTE const* lastHashed = NULL;
    U64 rollingHash = 0;
  • replacement in zstd/lib/compress/zstd_ldm.c at line 301
    [2.1558990][2.1558990:1559187]()
    while (n < minMatchLength) {
    numSplits = 0;
    n += ZSTD_ldm_gear_feed(&hashState, ip + n, minMatchLength - n,
    splits, &numSplits);
    [2.1558990]
    [2.1559187]
    while (ip <= ilimit) {
    size_t mLength;
    U32 const curr = (U32)(ip - base);
    size_t forwardMatchLength = 0, backwardMatchLength = 0;
    ldmEntry_t* bestEntry = NULL;
    if (ip != istart) {
    rollingHash = ZSTD_rollingHash_rotate(rollingHash, lastHashed[0],
    lastHashed[minMatchLength],
    hashPower);
    } else {
    rollingHash = ZSTD_rollingHash_compute(ip, minMatchLength);
  • replacement in zstd/lib/compress/zstd_ldm.c at line 313
    [2.1559197][2.1559197:1559449]()
    ip += minMatchLength;
    }
    while (ip < ilimit) {
    size_t hashed;
    unsigned n;
    numSplits = 0;
    hashed = ZSTD_ldm_gear_feed(&hashState, ip, ilimit - ip,
    splits, &numSplits);
    [2.1559197]
    [2.1559449]
    lastHashed = ip;
  • replacement in zstd/lib/compress/zstd_ldm.c at line 315
    [2.1559450][2.1559450:1559963]()
    for (n = 0; n < numSplits; n++) {
    BYTE const* const split = ip + splits[n] - minMatchLength;
    U64 const xxhash = XXH64(split, minMatchLength, 0);
    U32 const hash = (U32)(xxhash & (((U32)1 << hBits) - 1));
    candidates[n].split = split;
    candidates[n].hash = hash;
    candidates[n].checksum = (U32)(xxhash >> 32);
    candidates[n].bucket = ZSTD_ldm_getBucket(ldmState, hash, *params);
    PREFETCH_L1(candidates[n].bucket);
    [2.1559450]
    [2.1559963]
    /* Do not insert and do not look for a match */
    if (ZSTD_ldm_getTag(rollingHash, hBits, hashRateLog) != ldmTagMask) {
    ip++;
    continue;
  • edit in zstd/lib/compress/zstd_ldm.c at line 320
    [2.1559973][2.1559973:1560475]()
    for (n = 0; n < numSplits; n++) {
    size_t forwardMatchLength = 0, backwardMatchLength = 0,
    bestMatchLength = 0, mLength;
    BYTE const* const split = candidates[n].split;
    U32 const checksum = candidates[n].checksum;
    U32 const hash = candidates[n].hash;
    ldmEntry_t* const bucket = candidates[n].bucket;
    ldmEntry_t const* cur;
    ldmEntry_t const* bestEntry = NULL;
    ldmEntry_t newEntry;
  • replacement in zstd/lib/compress/zstd_ldm.c at line 321
    [2.1560476][2.1560476:1560895]()
    newEntry.offset = (U32)(split - base);
    newEntry.checksum = checksum;
    /* If a split point would generate a sequence overlapping with
    * the previous one, we merely register it in the hash table and
    * move on */
    if (split < anchor) {
    ZSTD_ldm_insertEntry(ldmState, hash, newEntry, *params);
    continue;
    }
    [2.1560476]
    [2.1560895]
    /* Get the best entry and compute the match lengths */
    {
    ldmEntry_t* const bucket =
    ZSTD_ldm_getBucket(ldmState,
    ZSTD_ldm_getSmallHash(rollingHash, hBits),
    *params);
    ldmEntry_t* cur;
    size_t bestMatchLength = 0;
    U32 const checksum = ZSTD_ldm_getChecksum(rollingHash, hBits);
  • replacement in zstd/lib/compress/zstd_ldm.c at line 331
    [2.1560896][2.1560896:1560966]()
    for (cur = bucket; cur < bucket + entsPerBucket; cur++) {
    [2.1560896]
    [2.1560966]
    for (cur = bucket; cur < bucket + ldmBucketSize; ++cur) {
  • replacement in zstd/lib/compress/zstd_ldm.c at line 345
    [2.1561676][2.1561676:1561811]()
    curForwardMatchLength =
    ZSTD_count_2segments(split, pMatch, iend, matchEnd, lowPrefixPtr);
    [2.1561676]
    [2.1561811]
    curForwardMatchLength = ZSTD_count_2segments(
    ip, pMatch, iend,
    matchEnd, lowPrefixPtr);
  • replacement in zstd/lib/compress/zstd_ldm.c at line 352
    [2.1561933][2.1561933:1562103]()
    curBackwardMatchLength = ZSTD_ldm_countBackwardsMatch_2segments(
    split, anchor, pMatch, lowMatchPtr, dictStart, dictEnd);
    [2.1561933]
    [2.1562103]
    curBackwardMatchLength =
    ZSTD_ldm_countBackwardsMatch_2segments(ip, anchor,
    pMatch, lowMatchPtr,
    dictStart, dictEnd);
    curTotalMatchLength = curForwardMatchLength +
    curBackwardMatchLength;
  • replacement in zstd/lib/compress/zstd_ldm.c at line 360
    [2.1562210][2.1562210:1562287]()
    curForwardMatchLength = ZSTD_count(split, pMatch, iend);
    [2.1562210]
    [2.1562287]
    curForwardMatchLength = ZSTD_count(ip, pMatch, iend);
  • replacement in zstd/lib/compress/zstd_ldm.c at line 365
    [2.1562454][2.1562454:1562545]()
    ZSTD_ldm_countBackwardsMatch(split, anchor, pMatch, lowPrefixPtr);
    [2.1562454]
    [2.1562545]
    ZSTD_ldm_countBackwardsMatch(ip, anchor, pMatch,
    lowPrefixPtr);
    curTotalMatchLength = curForwardMatchLength +
    curBackwardMatchLength;
  • edit in zstd/lib/compress/zstd_ldm.c at line 370
    [2.1562563][2.1562563:1562649]()
    curTotalMatchLength = curForwardMatchLength + curBackwardMatchLength;
  • edit in zstd/lib/compress/zstd_ldm.c at line 377
    [2.1562955][2.1562955:1563230]()
    }
    /* No match found -- insert an entry into the hash table
    * and process the next candidate match */
    if (bestEntry == NULL) {
    ZSTD_ldm_insertEntry(ldmState, hash, newEntry, *params);
    continue;
  • edit in zstd/lib/compress/zstd_ldm.c at line 378
    [2.1563244]
    [2.1563244]
    }
  • replacement in zstd/lib/compress/zstd_ldm.c at line 380
    [2.1563245][2.1563245:1563503]()
    /* Match found */
    mLength = forwardMatchLength + backwardMatchLength;
    {
    U32 const offset = (U32)(split - base) - bestEntry->offset;
    rawSeq* const seq = rawSeqStore->seq + rawSeqStore->size;
    [2.1563245]
    [2.1563503]
    /* No match found -- continue searching */
    if (bestEntry == NULL) {
    ZSTD_ldm_makeEntryAndInsertByTag(ldmState, rollingHash,
    hBits, curr,
    *params);
    ip++;
    continue;
    }
  • replacement in zstd/lib/compress/zstd_ldm.c at line 389
    [2.1563504][2.1563504:1563882]()
    /* Out of sequence storage */
    if (rawSeqStore->size == rawSeqStore->capacity)
    return ERROR(dstSize_tooSmall);
    seq->litLength = (U32)(split - backwardMatchLength - anchor);
    seq->matchLength = (U32)mLength;
    seq->offset = offset;
    rawSeqStore->size++;
    }
    [2.1563504]
    [2.1563882]
    /* Match found */
    mLength = forwardMatchLength + backwardMatchLength;
    ip -= backwardMatchLength;
  • replacement in zstd/lib/compress/zstd_ldm.c at line 393
    [2.1563883][2.1563883:1564105]()
    /* Insert the current entry into the hash table --- it must be
    * done after the previous block to avoid clobbering bestEntry */
    ZSTD_ldm_insertEntry(ldmState, hash, newEntry, *params);
    [2.1563883]
    [2.1564105]
    {
    /* Store the sequence:
    * ip = curr - backwardMatchLength
    * The match is at (bestEntry->offset - backwardMatchLength)
    */
    U32 const matchIndex = bestEntry->offset;
    U32 const offset = curr - matchIndex;
    rawSeq* const seq = rawSeqStore->seq + rawSeqStore->size;
  • replacement in zstd/lib/compress/zstd_ldm.c at line 402
    [2.1564106][2.1564106:1564155]()
    anchor = split + forwardMatchLength;
    [2.1564106]
    [2.1564155]
    /* Out of sequence storage */
    if (rawSeqStore->size == rawSeqStore->capacity)
    return ERROR(dstSize_tooSmall);
    seq->litLength = (U32)(ip - anchor);
    seq->matchLength = (U32)mLength;
    seq->offset = offset;
    rawSeqStore->size++;
  • replacement in zstd/lib/compress/zstd_ldm.c at line 411
    [2.1564166][2.1564166:1564194]()
    ip += hashed;
    }
    [2.1564166]
    [2.1564194]
    /* Insert the current entry into the hash table */
    ZSTD_ldm_makeEntryAndInsertByTag(ldmState, rollingHash, hBits,
    (U32)(lastHashed - base),
    *params);
    assert(ip + backwardMatchLength == lastHashed);
  • edit in zstd/lib/compress/zstd_ldm.c at line 418
    [2.1564195]
    [2.1564195]
    /* Fill the hash table from lastHashed+1 to ip+mLength*/
    /* Heuristic: don't need to fill the entire table at end of block */
    if (ip + mLength <= ilimit) {
    rollingHash = ZSTD_ldm_fillLdmHashTable(
    ldmState, rollingHash, lastHashed,
    ip + mLength, base, hBits, *params);
    lastHashed = ip + mLength - 1;
    }
    ip += mLength;
    anchor = ip;
    }
  • replacement in zstd/lib/compress/zstd_ldm.c at line 623
    [2.1572318][2.1572318:1572402]()
    /* Loop through each sequence and apply the block compressor to the literals */
    [2.1572318]
    [2.1572402]
    /* Loop through each sequence and apply the block compressor to the lits */
  • replacement in zstd/lib/compress/zstd_lazy.h at line 2
    [2.1574010][2.1574010:1574066]()
    * Copyright (c) 2016-2021, Yann Collet, Facebook, Inc.
    [2.1574010]
    [2.1574066]
    * Copyright (c) 2016-2020, Yann Collet, Facebook, Inc.
  • replacement in zstd/lib/compress/zstd_lazy.c at line 2
    [2.1577642][2.1577642:1577698]()
    * Copyright (c) 2016-2021, Yann Collet, Facebook, Inc.
    [2.1577642]
    [2.1577698]
    * Copyright (c) 2016-2020, Yann Collet, Facebook, Inc.
  • replacement in zstd/lib/compress/zstd_fast.h at line 2
    [2.1641073][2.1641073:1641129]()
    * Copyright (c) 2016-2021, Yann Collet, Facebook, Inc.
    [2.1641073]
    [2.1641129]
    * Copyright (c) 2016-2020, Yann Collet, Facebook, Inc.
  • replacement in zstd/lib/compress/zstd_fast.c at line 2
    [2.1642322][2.1642322:1642378]()
    * Copyright (c) 2016-2021, Yann Collet, Facebook, Inc.
    [2.1642322]
    [2.1642378]
    * Copyright (c) 2016-2020, Yann Collet, Facebook, Inc.
  • replacement in zstd/lib/compress/zstd_fast.c at line 245
    [2.1652459][2.1652459:1652500]()
    /* ensure there will be no underflow
    [2.1652459]
    [2.1652500]
    /* ensure there will be no no underflow
  • replacement in zstd/lib/compress/zstd_double_fast.h at line 2
    [2.1664693][2.1664693:1664749]()
    * Copyright (c) 2016-2021, Yann Collet, Facebook, Inc.
    [2.1664693]
    [2.1664749]
    * Copyright (c) 2016-2020, Yann Collet, Facebook, Inc.
  • replacement in zstd/lib/compress/zstd_double_fast.c at line 2
    [2.1666029][2.1666029:1666085]()
    * Copyright (c) 2016-2021, Yann Collet, Facebook, Inc.
    [2.1666029]
    [2.1666085]
    * Copyright (c) 2016-2020, Yann Collet, Facebook, Inc.
  • replacement in zstd/lib/compress/zstd_cwksp.h at line 2
    [2.1691379][2.1691379:1691435]()
    * Copyright (c) 2016-2021, Yann Collet, Facebook, Inc.
    [2.1691379]
    [2.1691435]
    * Copyright (c) 2016-2020, Yann Collet, Facebook, Inc.
  • replacement in zstd/lib/compress/zstd_cwksp.h at line 506
    [2.1709711][2.1709711:1709793]()
    * is left in an invalid state (src must be re-init()'ed before it's used again).
    [2.1709711]
    [2.1709793]
    * is left in an invalid state (src must be re-init()'ed before its used again).
  • replacement in zstd/lib/compress/zstd_compress_superblock.h at line 2
    [2.1711585][2.1711585:1711641]()
    * Copyright (c) 2016-2021, Yann Collet, Facebook, Inc.
    [2.1711585]
    [2.1711641]
    * Copyright (c) 2016-2020, Yann Collet, Facebook, Inc.
  • replacement in zstd/lib/compress/zstd_compress_superblock.c at line 2
    [2.1712809][2.1712809:1712865]()
    * Copyright (c) 2016-2021, Yann Collet, Facebook, Inc.
    [2.1712809]
    [2.1712865]
    * Copyright (c) 2016-2020, Yann Collet, Facebook, Inc.
  • replacement in zstd/lib/compress/zstd_compress_superblock.c at line 307
    [2.1729024][2.1729024:1729111]()
    * We write the header when writeEntropy=1 and set entropyWritten=1 when we succeeded
    [2.1729024]
    [2.1729111]
    * We write the header when writeEntropy=1 and set entropyWrriten=1 when we succeeded
  • replacement in zstd/lib/compress/zstd_compress_sequences.h at line 2
    [2.1756276][2.1756276:1756332]()
    * Copyright (c) 2016-2021, Yann Collet, Facebook, Inc.
    [2.1756276]
    [2.1756332]
    * Copyright (c) 2016-2020, Yann Collet, Facebook, Inc.
  • replacement in zstd/lib/compress/zstd_compress_sequences.c at line 2
    [2.1758506][2.1758506:1758562]()
    * Copyright (c) 2016-2021, Yann Collet, Facebook, Inc.
    [2.1758506]
    [2.1758562]
    * Copyright (c) 2016-2020, Yann Collet, Facebook, Inc.
  • replacement in zstd/lib/compress/zstd_compress_literals.h at line 2
    [2.1778250][2.1778250:1778306]()
    * Copyright (c) 2016-2021, Yann Collet, Facebook, Inc.
    [2.1778250]
    [2.1778306]
    * Copyright (c) 2016-2020, Yann Collet, Facebook, Inc.
  • replacement in zstd/lib/compress/zstd_compress_literals.c at line 2
    [2.1779523][2.1779523:1779579]()
    * Copyright (c) 2016-2021, Yann Collet, Facebook, Inc.
    [2.1779523]
    [2.1779579]
    * Copyright (c) 2016-2020, Yann Collet, Facebook, Inc.
  • replacement in zstd/lib/compress/zstd_compress_literals.c at line 18
    [2.1780142][2.1780142:1780179]()
    BYTE* const ostart = (BYTE*)dst;
    [2.1780142]
    [2.1780179]
    BYTE* const ostart = (BYTE* const)dst;
  • replacement in zstd/lib/compress/zstd_compress_literals.c at line 45
    [2.1781078][2.1781078:1781115]()
    BYTE* const ostart = (BYTE*)dst;
    [2.1781078]
    [2.1781115]
    BYTE* const ostart = (BYTE* const)dst;
  • replacement in zstd/lib/compress/zstd_compress_internal.h at line 2
    [2.1785835][2.1785835:1785891]()
    * Copyright (c) 2016-2021, Yann Collet, Facebook, Inc.
    [2.1785835]
    [2.1785891]
    * Copyright (c) 2016-2020, Yann Collet, Facebook, Inc.
  • edit in zstd/lib/compress/zstd_compress_internal.h at line 22
    [2.1786506][2.1786506:1786561]()
    #include "../common/zstd_trace.h" /* ZSTD_TraceCtx */
  • edit in zstd/lib/compress/zstd_compress_internal.h at line 185
    [2.1793574][2.1793574:1793694]()
    typedef struct {
    BYTE const* split;
    U32 hash;
    U32 checksum;
    ldmEntry_t* bucket;
    } ldmMatchCandidate_t;
  • edit in zstd/lib/compress/zstd_compress_internal.h at line 186
    [2.1793695][2.1793695:1793722]()
    #define LDM_BATCH_SIZE 64
  • replacement in zstd/lib/compress/zstd_compress_internal.h at line 191
    [2.1793942][2.1793942:1794040]()
    size_t splitIndices[LDM_BATCH_SIZE];
    ldmMatchCandidate_t matchCandidates[LDM_BATCH_SIZE];
    [2.1793942]
    [2.1794040]
    U64 hashPower; /* Used to compute the rolling hash.
    * Depends on ldmParams.minMatchLength */
  • edit in zstd/lib/compress/zstd_compress_internal.h at line 273
    [2.1797178][2.1797178:1797206]()
    size_t dictContentSize;
  • edit in zstd/lib/compress/zstd_compress_internal.h at line 324
    [2.1798798][2.1798798:1798867]()
    /* Tracing */
    #if ZSTD_TRACE
    ZSTD_TraceCtx traceCtx;
    #endif
  • edit in zstd/lib/compress/zstd_compress_internal.h at line 1202
    [2.1835885][2.1835885:1836013]()
    /** ZSTD_CCtx_trace() :
    * Trace the end of a compression call.
    */
    void ZSTD_CCtx_trace(ZSTD_CCtx* cctx, size_t extraCSize);
  • replacement in zstd/lib/compress/zstd_compress.c at line 2
    [2.1836098][2.1836098:1836154]()
    * Copyright (c) 2016-2021, Yann Collet, Facebook, Inc.
    [2.1836098]
    [2.1836154]
    * Copyright (c) 2016-2020, Yann Collet, Facebook, Inc.
  • edit in zstd/lib/compress/zstd_compress.c at line 17
    [2.1836707][2.1836707:1836741]()
    #include "../common/zstd_trace.h"
  • edit in zstd/lib/compress/zstd_compress.c at line 270
    [2.1845456][2.1845456:1846173]()
    }
    #define ZSTD_NO_CLEVEL 0
    /**
    * Initializes the cctxParams from params and compressionLevel.
    * @param compressionLevel If params are derived from a compression level then that compression level, otherwise ZSTD_NO_CLEVEL.
    */
    static void ZSTD_CCtxParams_init_internal(ZSTD_CCtx_params* cctxParams, ZSTD_parameters const* params, int compressionLevel)
    {
    assert(!ZSTD_checkCParams(params->cParams));
    ZSTD_memset(cctxParams, 0, sizeof(*cctxParams));
    cctxParams->cParams = params->cParams;
    cctxParams->fParams = params->fParams;
    /* Should not matter, as all cParams are presumed properly defined.
    * But, set it for tracing anyway.
    */
    cctxParams->compressionLevel = compressionLevel;
  • replacement in zstd/lib/compress/zstd_compress.c at line 276
    [2.1846392][2.1846392:1846464]()
    ZSTD_CCtxParams_init_internal(cctxParams, &params, ZSTD_NO_CLEVEL);
    [2.1846392]
    [2.1846464]
    ZSTD_memset(cctxParams, 0, sizeof(*cctxParams));
    assert(!ZSTD_checkCParams(params.cParams));
    cctxParams->cParams = params.cParams;
    cctxParams->fParams = params.fParams;
    cctxParams->compressionLevel = ZSTD_CLEVEL_DEFAULT; /* should not matter, as all cParams are presumed properly defined */
  • replacement in zstd/lib/compress/zstd_compress.c at line 284
    [2.1846481][2.1846481:1846730]()
    /**
    * Sets cctxParams' cParams and fParams from params, but otherwise leaves them alone.
    * @param param Validated zstd parameters.
    */
    static void ZSTD_CCtxParams_setZstdParams(
    ZSTD_CCtx_params* cctxParams, const ZSTD_parameters* params)
    [2.1846481]
    [2.1846730]
    /* ZSTD_assignParamsToCCtxParams() :
    * params is presumed valid at this stage */
    static ZSTD_CCtx_params ZSTD_assignParamsToCCtxParams(
    const ZSTD_CCtx_params* cctxParams, const ZSTD_parameters* params)
  • edit in zstd/lib/compress/zstd_compress.c at line 289
    [2.1846732]
    [2.1846732]
    ZSTD_CCtx_params ret = *cctxParams;
  • replacement in zstd/lib/compress/zstd_compress.c at line 291
    [2.1846781][2.1846781:1847037]()
    cctxParams->cParams = params->cParams;
    cctxParams->fParams = params->fParams;
    /* Should not matter, as all cParams are presumed properly defined.
    * But, set it for tracing anyway.
    */
    cctxParams->compressionLevel = ZSTD_NO_CLEVEL;
    [2.1846781]
    [2.1847037]
    ret.cParams = params->cParams;
    ret.fParams = params->fParams;
    ret.compressionLevel = ZSTD_CLEVEL_DEFAULT; /* should not matter, as all cParams are presumed properly defined */
    return ret;
  • replacement in zstd/lib/compress/zstd_compress.c at line 799
    [2.1863514][2.1863514:1863602]()
    size_t ZSTD_CCtx_getParameter(ZSTD_CCtx const* cctx, ZSTD_cParameter param, int* value)
    [2.1863514]
    [2.1863602]
    size_t ZSTD_CCtx_getParameter(ZSTD_CCtx* cctx, ZSTD_cParameter param, int* value)
  • replacement in zstd/lib/compress/zstd_compress.c at line 805
    [2.1863723][2.1863723:1863802]()
    ZSTD_CCtx_params const* CCtxParams, ZSTD_cParameter param, int* value)
    [2.1863723]
    [2.1863802]
    ZSTD_CCtx_params* CCtxParams, ZSTD_cParameter param, int* value)
  • edit in zstd/lib/compress/zstd_compress.c at line 1191
    [2.1877896]
    [2.1877896]
    if (dictSize && srcSize == ZSTD_CONTENTSIZE_UNKNOWN)
    srcSize = minSrcSize;
  • edit in zstd/lib/compress/zstd_compress.c at line 1195
    [2.1877916][2.1877916:1877943]()
    case ZSTD_cpm_unknown:
  • replacement in zstd/lib/compress/zstd_compress.c at line 1196
    [2.1877975][2.1877975:1878182]()
    /* If we don't know the source size, don't make any
    * assumptions about it. We will already have selected
    * smaller parameters if a dictionary is in use.
    */
    break;
    [2.1877975]
    [2.1878182]
    case ZSTD_cpm_unknown:
  • edit in zstd/lib/compress/zstd_compress.c at line 1198
    [2.1878213][2.1878213:1878424]()
    /* Assume a small source size when creating a dictionary
    * with an unkown source size.
    */
    if (dictSize && srcSize == ZSTD_CONTENTSIZE_UNKNOWN)
    srcSize = minSrcSize;
  • edit in zstd/lib/compress/zstd_compress.c at line 1200
    [2.1878469][2.1878469:1878641]()
    /* Dictionary has its own dedicated parameters which have
    * already been selected. We are selecting parameters
    * for only the source.
    */
  • replacement in zstd/lib/compress/zstd_compress.c at line 1216
    [2.1879194][2.1879194:1879346]()
    if (srcSize != ZSTD_CONTENTSIZE_UNKNOWN) {
    U32 const dictAndWindowLog = ZSTD_dictAndWindowLog(cPar.windowLog, (U64)srcSize, (U64)dictSize);
    [2.1879194]
    [2.1879346]
    { U32 const dictAndWindowLog = ZSTD_dictAndWindowLog(cPar.windowLog, (U64)srcSize, (U64)dictSize);
  • edit in zstd/lib/compress/zstd_compress.c at line 1618
    [2.1896517]
    [2.1896517]
    zc->ldmState.hashPower = ZSTD_rollingHash_primePower(params.ldmParams.minMatchLength);
  • edit in zstd/lib/compress/zstd_compress.c at line 1695
    [2.1900502][2.1900502:1900535]()
    zc->dictContentSize = 0;
  • replacement in zstd/lib/compress/zstd_compress.c at line 1714
    [2.1901298][2.1901298:1901336]()
    size_t const numBuckets =
    [2.1901298]
    [2.1901336]
    size_t const ldmBucketSize =
  • replacement in zstd/lib/compress/zstd_compress.c at line 1717
    [2.1901464][2.1901464:1901616]()
    zc->ldmState.bucketOffsets = ZSTD_cwksp_reserve_buffer(ws, numBuckets);
    ZSTD_memset(zc->ldmState.bucketOffsets, 0, numBuckets);
    [2.1901464]
    [2.1901616]
    zc->ldmState.bucketOffsets = ZSTD_cwksp_reserve_buffer(ws, ldmBucketSize);
    ZSTD_memset(zc->ldmState.bucketOffsets, 0, ldmBucketSize);
  • edit in zstd/lib/compress/zstd_compress.c at line 1855
    [2.1907593][2.1907593:1907645]()
    cctx->dictContentSize = cdict->dictContentSize;
  • edit in zstd/lib/compress/zstd_compress.c at line 1918
    [2.1910257][2.1910257:1910309]()
    cctx->dictContentSize = cdict->dictContentSize;
  • edit in zstd/lib/compress/zstd_compress.c at line 2008
    [2.1914594][2.1914594:1914651]()
    dstCCtx->dictContentSize = srcCCtx->dictContentSize;
  • edit in zstd/lib/compress/zstd_compress.c at line 2957
    [2.1957834][2.1957834:1958925]()
    /* ZSTD_writeSkippableFrame_advanced() :
    * Writes out a skippable frame with the specified magic number variant (16 are supported),
    * from ZSTD_MAGIC_SKIPPABLE_START to ZSTD_MAGIC_SKIPPABLE_START+15, and the desired source data.
    *
    * Returns the total number of bytes written, or a ZSTD error code.
    */
    size_t ZSTD_writeSkippableFrame(void* dst, size_t dstCapacity,
    const void* src, size_t srcSize, unsigned magicVariant) {
    BYTE* op = (BYTE*)dst;
    RETURN_ERROR_IF(dstCapacity < srcSize + ZSTD_SKIPPABLEHEADERSIZE /* Skippable frame overhead */,
    dstSize_tooSmall, "Not enough room for skippable frame");
    RETURN_ERROR_IF(srcSize > (unsigned)0xFFFFFFFF, srcSize_wrong, "Src size too large for skippable frame");
    RETURN_ERROR_IF(magicVariant > 15, parameter_outOfBound, "Skippable frame magic number variant not supported");
    MEM_writeLE32(op, (U32)(ZSTD_MAGIC_SKIPPABLE_START + magicVariant));
    MEM_writeLE32(op+4, (U32)srcSize);
    ZSTD_memcpy(op+8, src, srcSize);
    return srcSize + ZSTD_SKIPPABLEHEADERSIZE;
    }
  • edit in zstd/lib/compress/zstd_compress.c at line 3351
    [2.1975797][2.1975797:1975873]()
    #if ZSTD_TRACE
    cctx->traceCtx = ZSTD_trace_compress_begin(cctx);
    #endif
  • edit in zstd/lib/compress/zstd_compress.c at line 3380
    [2.1977611][2.1977611:1977686]()
    cctx->dictContentSize = cdict ? cdict->dictContentSize : dictSize;
  • replacement in zstd/lib/compress/zstd_compress.c at line 3408
    [2.1978988][2.1978988:1979094]()
    ZSTD_CCtx_params cctxParams;
    ZSTD_CCtxParams_init_internal(&cctxParams, &params, ZSTD_NO_CLEVEL);
    [2.1978988]
    [2.1979094]
    ZSTD_CCtx_params const cctxParams =
    ZSTD_assignParamsToCCtxParams(&cctx->requestedParams, &params);
  • replacement in zstd/lib/compress/zstd_compress.c at line 3418
    [2.1979488][2.1979488:1979801]()
    ZSTD_CCtx_params cctxParams;
    {
    ZSTD_parameters const params = ZSTD_getParams_internal(compressionLevel, ZSTD_CONTENTSIZE_UNKNOWN, dictSize, ZSTD_cpm_noAttachDict);
    ZSTD_CCtxParams_init_internal(&cctxParams, &params, (compressionLevel == 0) ? ZSTD_CLEVEL_DEFAULT : compressionLevel);
    }
    [2.1979488]
    [2.1979801]
    ZSTD_parameters const params = ZSTD_getParams_internal(compressionLevel, ZSTD_CONTENTSIZE_UNKNOWN, dictSize, ZSTD_cpm_noAttachDict);
    ZSTD_CCtx_params const cctxParams =
    ZSTD_assignParamsToCCtxParams(&cctx->requestedParams, &params);
  • edit in zstd/lib/compress/zstd_compress.c at line 3472
    [2.1981801][2.1981801:1982601]()
    }
    void ZSTD_CCtx_trace(ZSTD_CCtx* cctx, size_t extraCSize)
    {
    #if ZSTD_TRACE
    if (cctx->traceCtx) {
    int const streaming = cctx->inBuffSize > 0 || cctx->outBuffSize > 0 || cctx->appliedParams.nbWorkers > 0;
    ZSTD_Trace trace;
    ZSTD_memset(&trace, 0, sizeof(trace));
    trace.version = ZSTD_VERSION_NUMBER;
    trace.streaming = streaming;
    trace.dictionaryID = cctx->dictID;
    trace.dictionarySize = cctx->dictContentSize;
    trace.uncompressedSize = cctx->consumedSrcSize;
    trace.compressedSize = cctx->producedCSize + extraCSize;
    trace.params = &cctx->appliedParams;
    trace.cctx = cctx;
    ZSTD_trace_compress_end(cctx->traceCtx, &trace);
    }
    cctx->traceCtx = 0;
    #else
    (void)cctx;
    (void)extraCSize;
    #endif
  • edit in zstd/lib/compress/zstd_compress.c at line 3496
    [2.1983787][2.1983787:1983825]()
    ZSTD_CCtx_trace(cctx, endResult);
  • edit in zstd/lib/compress/zstd_compress.c at line 3499
    [2.1983858]
    [2.1983858]
    static size_t ZSTD_compress_internal (ZSTD_CCtx* cctx,
    void* dst, size_t dstCapacity,
    const void* src, size_t srcSize,
    const void* dict,size_t dictSize,
    const ZSTD_parameters* params)
    {
    ZSTD_CCtx_params const cctxParams =
    ZSTD_assignParamsToCCtxParams(&cctx->requestedParams, params);
    DEBUGLOG(4, "ZSTD_compress_internal");
    return ZSTD_compress_advanced_internal(cctx,
    dst, dstCapacity,
    src, srcSize,
    dict, dictSize,
    &cctxParams);
    }
  • edit in zstd/lib/compress/zstd_compress.c at line 3521
    [2.1984142][2.1984142:1984175]()
    ZSTD_CCtx_params cctxParams;
  • replacement in zstd/lib/compress/zstd_compress.c at line 3523
    [2.1984279][2.1984279:1984635]()
    ZSTD_CCtxParams_init_internal(&cctxParams, &params, ZSTD_NO_CLEVEL);
    return ZSTD_compress_advanced_internal(cctx,
    dst, dstCapacity,
    src, srcSize,
    dict, dictSize,
    &cctxParams);
    [2.1984279]
    [2.1984635]
    return ZSTD_compress_internal(cctx,
    dst, dstCapacity,
    src, srcSize,
    dict, dictSize,
    &params);
  • replacement in zstd/lib/compress/zstd_compress.c at line 3551
    [2.1985522][2.1985522:1985881]()
    ZSTD_CCtx_params cctxParams;
    {
    ZSTD_parameters const params = ZSTD_getParams_internal(compressionLevel, srcSize, dict ? dictSize : 0, ZSTD_cpm_noAttachDict);
    assert(params.fParams.contentSizeFlag == 1);
    ZSTD_CCtxParams_init_internal(&cctxParams, &params, (compressionLevel == 0) ? ZSTD_CLEVEL_DEFAULT: compressionLevel);
    }
    [2.1985522]
    [2.1985881]
    ZSTD_parameters const params = ZSTD_getParams_internal(compressionLevel, srcSize, dict ? dictSize : 0, ZSTD_cpm_noAttachDict);
    ZSTD_CCtx_params cctxParams = ZSTD_assignParamsToCCtxParams(&cctx->requestedParams, &params);
  • edit in zstd/lib/compress/zstd_compress.c at line 3554
    [2.1985957]
    [2.1985957]
    assert(params.fParams.contentSizeFlag == 1);
  • replacement in zstd/lib/compress/zstd_compress.c at line 3701
    [2.1992084][2.1992084:1992167]()
    cdict->compressionLevel = ZSTD_NO_CLEVEL; /* signals advanced API usage */
    [2.1992084]
    [2.1992167]
    cdict->compressionLevel = 0; /* signals advanced API usage */
  • edit in zstd/lib/compress/zstd_compress.c at line 3884
    [2.1999519][2.1999519:1999552]()
    ZSTD_CCtx_params cctxParams;
  • replacement in zstd/lib/compress/zstd_compress.c at line 3886
    [2.1999680][2.1999680:1999803]()
    /* Initialize the cctxParams from the cdict */
    {
    ZSTD_parameters params;
    params.fParams = fParams;
    [2.1999680]
    [2.1999803]
    { ZSTD_CCtx_params params = cctx->requestedParams;
  • replacement in zstd/lib/compress/zstd_compress.c at line 3890
    [2.2000065][2.2000065:2000125]()
    || cdict->compressionLevel == 0 ) ?
    [2.2000065]
    [2.2000125]
    || cdict->compressionLevel == 0 )
    && (params.attachDictPref != ZSTD_dictForceLoad) ?
  • replacement in zstd/lib/compress/zstd_compress.c at line 3896
    [2.2000335][2.2000335:2000421]()
    ZSTD_CCtxParams_init_internal(&cctxParams, &params, cdict->compressionLevel);
    [2.2000335]
    [2.2000421]
    /* Increase window log to fit the entire dictionary and source if the
    * source size is known. Limit the increase to 19, which is the
    * window log for compression level 1 with the largest source size.
    */
    if (pledgedSrcSize != ZSTD_CONTENTSIZE_UNKNOWN) {
    U32 const limitedSrcSize = (U32)MIN(pledgedSrcSize, 1U << 19);
    U32 const limitedSrcLog = limitedSrcSize > 1 ? ZSTD_highbit32(limitedSrcSize - 1) + 1 : 1;
    params.cParams.windowLog = MAX(params.cParams.windowLog, limitedSrcLog);
    }
    params.fParams = fParams;
    return ZSTD_compressBegin_internal(cctx,
    NULL, 0, ZSTD_dct_auto, ZSTD_dtlm_fast,
    cdict,
    &params, pledgedSrcSize,
    ZSTDb_not_buffered);
  • edit in zstd/lib/compress/zstd_compress.c at line 3912
    [2.2000427][2.2000427:2001270]()
    /* Increase window log to fit the entire dictionary and source if the
    * source size is known. Limit the increase to 19, which is the
    * window log for compression level 1 with the largest source size.
    */
    if (pledgedSrcSize != ZSTD_CONTENTSIZE_UNKNOWN) {
    U32 const limitedSrcSize = (U32)MIN(pledgedSrcSize, 1U << 19);
    U32 const limitedSrcLog = limitedSrcSize > 1 ? ZSTD_highbit32(limitedSrcSize - 1) + 1 : 1;
    cctxParams.cParams.windowLog = MAX(cctxParams.cParams.windowLog, limitedSrcLog);
    }
    return ZSTD_compressBegin_internal(cctx,
    NULL, 0, ZSTD_dct_auto, ZSTD_dtlm_fast,
    cdict,
    &cctxParams, pledgedSrcSize,
    ZSTDb_not_buffered);
  • replacement in zstd/lib/compress/zstd_compress.c at line 4074
    [2.2008002][2.2008002:2008069]()
    ZSTD_CCtxParams_setZstdParams(&zcs->requestedParams, &params);
    [2.2008002]
    [2.2008069]
    zcs->requestedParams = ZSTD_assignParamsToCCtxParams(&zcs->requestedParams, &params);
  • edit in zstd/lib/compress/zstd_compress.c at line 4379
    [2.2022312][2.2022312:2022392]()
    #if ZSTD_TRACE
    cctx->traceCtx = ZSTD_trace_compress_begin(cctx);
    #endif
  • edit in zstd/lib/compress/zstd_compress.c at line 4392
    [2.2023164][2.2023164:2023392]()
    cctx->dictID = cctx->cdict ? cctx->cdict->dictID : 0;
    cctx->dictContentSize = cctx->cdict ? cctx->cdict->dictContentSize : prefixDict.dictSize;
    cctx->consumedSrcSize = 0;
    cctx->producedCSize = 0;
  • edit in zstd/lib/compress/zstd_compress.c at line 4453
    [2.2026134][2.2026134:2026259]()
    cctx->consumedSrcSize += (U64)(input->pos - ipos);
    cctx->producedCSize += (U64)(output->pos - opos);
  • edit in zstd/lib/compress/zstd_compress.c at line 4455
    [2.2026387][2.2026387:2026468]()
    if (flushMin == 0)
    ZSTD_CCtx_trace(cctx, 0);
  • replacement in zstd/lib/compress/huf_compress.c at line 3
    [2.2063255][2.2063255:2063311]()
    * Copyright (c) 2013-2021, Yann Collet, Facebook, Inc.
    [2.2063255]
    [2.2063311]
    * Copyright (c) 2013-2020, Yann Collet, Facebook, Inc.
  • replacement in zstd/lib/compress/hist.h at line 4
    [2.2101644][2.2101644:2101700]()
    * Copyright (c) 2013-2021, Yann Collet, Facebook, Inc.
    [2.2101644]
    [2.2101700]
    * Copyright (c) 2013-2020, Yann Collet, Facebook, Inc.
  • replacement in zstd/lib/compress/hist.c at line 4
    [2.2105128][2.2105128:2105184]()
    * Copyright (c) 2013-2021, Yann Collet, Facebook, Inc.
    [2.2105128]
    [2.2105184]
    * Copyright (c) 2013-2020, Yann Collet, Facebook, Inc.
  • replacement in zstd/lib/compress/fse_compress.c at line 3
    [2.2112580][2.2112580:2112636]()
    * Copyright (c) 2013-2021, Yann Collet, Facebook, Inc.
    [2.2112580]
    [2.2112636]
    * Copyright (c) 2013-2020, Yann Collet, Facebook, Inc.
  • replacement in zstd/lib/common/zstd_internal.h at line 2
    [2.2144718][2.2144718:2144774]()
    * Copyright (c) 2016-2021, Yann Collet, Facebook, Inc.
    [2.2144718]
    [2.2144774]
    * Copyright (c) 2016-2020, Yann Collet, Facebook, Inc.
  • replacement in zstd/lib/common/zstd_errors.h at line 2
    [2.2160641][2.2160641:2160697]()
    * Copyright (c) 2016-2021, Yann Collet, Facebook, Inc.
    [2.2160641]
    [2.2160697]
    * Copyright (c) 2016-2020, Yann Collet, Facebook, Inc.
  • replacement in zstd/lib/common/zstd_deps.h at line 2
    [2.2164510][2.2164510:2164553]()
    * Copyright (c) 2016-2021, Facebook, Inc.
    [2.2164510]
    [2.2164553]
    * Copyright (c) 2016-2020, Facebook, Inc.
  • replacement in zstd/lib/common/zstd_common.c at line 2
    [2.2167046][2.2167046:2167102]()
    * Copyright (c) 2016-2021, Yann Collet, Facebook, Inc.
    [2.2167046]
    [2.2167102]
    * Copyright (c) 2016-2020, Yann Collet, Facebook, Inc.
  • replacement in zstd/lib/common/xxhash.h at line 4
    [2.2169872][2.2169872:2169928]()
    * Copyright (c) 2012-2021, Yann Collet, Facebook, Inc.
    [2.2169872]
    [2.2169928]
    * Copyright (c) 2012-2020, Yann Collet, Facebook, Inc.
  • replacement in zstd/lib/common/xxhash.c at line 3
    [2.2181590][2.2181590:2181647]()
    * Copyright (c) 2012-2021, Yann Collet, Facebook, Inc.
    [2.2181590]
    [2.2181647]
    * Copyright (c) 2012-2020, Yann Collet, Facebook, Inc.
  • replacement in zstd/lib/common/pool.h at line 2
    [2.2216943][2.2216943:2216999]()
    * Copyright (c) 2016-2021, Yann Collet, Facebook, Inc.
    [2.2216943]
    [2.2216999]
    * Copyright (c) 2016-2020, Yann Collet, Facebook, Inc.
  • replacement in zstd/lib/common/pool.c at line 2
    [2.2219509][2.2219509:2219565]()
    * Copyright (c) 2016-2021, Yann Collet, Facebook, Inc.
    [2.2219509]
    [2.2219565]
    * Copyright (c) 2016-2020, Yann Collet, Facebook, Inc.
  • replacement in zstd/lib/common/mem.h at line 2
    [2.2230848][2.2230848:2230904]()
    * Copyright (c) 2016-2021, Yann Collet, Facebook, Inc.
    [2.2230848]
    [2.2230904]
    * Copyright (c) 2016-2020, Yann Collet, Facebook, Inc.
  • replacement in zstd/lib/common/huf.h at line 4
    [2.2244942][2.2244942:2244998]()
    * Copyright (c) 2013-2021, Yann Collet, Facebook, Inc.
    [2.2244942]
    [2.2244998]
    * Copyright (c) 2013-2020, Yann Collet, Facebook, Inc.
  • replacement in zstd/lib/common/fse_decompress.c at line 3
    [2.2265165][2.2265165:2265221]()
    * Copyright (c) 2013-2021, Yann Collet, Facebook, Inc.
    [2.2265165]
    [2.2265221]
    * Copyright (c) 2013-2020, Yann Collet, Facebook, Inc.
  • replacement in zstd/lib/common/fse.h at line 4
    [2.2279988][2.2279988:2280044]()
    * Copyright (c) 2013-2021, Yann Collet, Facebook, Inc.
    [2.2279988]
    [2.2280044]
    * Copyright (c) 2013-2020, Yann Collet, Facebook, Inc.
  • replacement in zstd/lib/common/error_private.h at line 2
    [2.2314463][2.2314463:2314519]()
    * Copyright (c) 2016-2021, Yann Collet, Facebook, Inc.
    [2.2314463]
    [2.2314519]
    * Copyright (c) 2016-2020, Yann Collet, Facebook, Inc.
  • replacement in zstd/lib/common/error_private.c at line 2
    [2.2316947][2.2316947:2317003]()
    * Copyright (c) 2016-2021, Yann Collet, Facebook, Inc.
    [2.2316947]
    [2.2317003]
    * Copyright (c) 2016-2020, Yann Collet, Facebook, Inc.
  • replacement in zstd/lib/common/entropy_common.c at line 3
    [2.2320120][2.2320120:2320176]()
    * Copyright (c) 2016-2021, Yann Collet, Facebook, Inc.
    [2.2320120]
    [2.2320176]
    * Copyright (c) 2016-2020, Yann Collet, Facebook, Inc.
  • replacement in zstd/lib/common/debug.h at line 4
    [2.2333932][2.2333932:2333988]()
    * Copyright (c) 2013-2021, Yann Collet, Facebook, Inc.
    [2.2333932]
    [2.2333988]
    * Copyright (c) 2013-2020, Yann Collet, Facebook, Inc.
  • replacement in zstd/lib/common/debug.c at line 4
    [2.2337730][2.2337730:2337786]()
    * Copyright (c) 2013-2021, Yann Collet, Facebook, Inc.
    [2.2337730]
    [2.2337786]
    * Copyright (c) 2013-2020, Yann Collet, Facebook, Inc.
  • replacement in zstd/lib/common/cpu.h at line 2
    [2.2338511][2.2338511:2338554]()
    * Copyright (c) 2018-2021, Facebook, Inc.
    [2.2338511]
    [2.2338554]
    * Copyright (c) 2018-2020, Facebook, Inc.
  • replacement in zstd/lib/common/compiler.h at line 2
    [2.2342999][2.2342999:2343055]()
    * Copyright (c) 2016-2021, Yann Collet, Facebook, Inc.
    [2.2342999]
    [2.2343055]
    * Copyright (c) 2016-2020, Yann Collet, Facebook, Inc.
  • edit in zstd/lib/common/compiler.h at line 93
    [2.2345727][2.2345727:2345728]()
  • replacement in zstd/lib/common/bitstream.h at line 4
    [2.2353298][2.2353298:2353354]()
    * Copyright (c) 2013-2021, Yann Collet, Facebook, Inc.
    [2.2353298]
    [2.2353354]
    * Copyright (c) 2013-2020, Yann Collet, Facebook, Inc.
  • replacement in zstd/lib/Makefile at line 2
    [2.2371496][2.2371496:2371551]()
    # Copyright (c) 2015-2021, Yann Collet, Facebook, Inc.
    [2.2371496]
    [2.2371551]
    # Copyright (c) 2015-2020, Yann Collet, Facebook, Inc.
  • edit in zstd/lib/Makefile at line 182
    [2.2376979][2.2376979:2377025]()
    else ifeq ($(UNAME), NetBSD)
    HASH ?= md5 -n
  • replacement in zstd/lib/Makefile at line 211
    [2.2378170][2.2378170:2378208]()
    +$(MAKE) --no-print-directory $@ \
    [2.2378170]
    [2.2378208]
    $(MAKE) --no-print-directory $@ \
  • replacement in zstd/lib/Makefile at line 218
    [2.2378321][2.2378321:2378342]()
    .PHONY: all
    all: lib
    [2.2378321]
    [2.2378342]
    .PHONY: lib-all all clean install uninstall
    # alias
    lib-all: all
  • edit in zstd/lib/Makefile at line 223
    [2.2378343]
    [2.2378343]
    all: lib
  • replacement in zstd/lib/Makefile at line 261
    [2.2379219][2.2379219:2379298]()
    $(LIBZSTD): CFLAGS += -fPIC -fvisibility=hidden
    $(LIBZSTD): LDFLAGS += -shared
    [2.2379219]
    [2.2379298]
    $(LIBZSTD): CFLAGS += -fPIC
    $(LIBZSTD): LDFLAGS += -shared -fvisibility=hidden
  • edit in zstd/lib/Makefile at line 342
    [2.2381345][2.2381345:2381359]()
    .PHONY: clean
  • edit in zstd/lib/Makefile at line 410
    [2.2383645][2.2383645:2383661]()
    .PHONY: install
  • edit in zstd/lib/Makefile at line 440
    [2.2384915][2.2384915:2384933]()
    .PHONY: uninstall
  • replacement in zstd/contrib/seekable_format/zstdseek_decompress.c at line 271
    [2.2393775][2.2393775:2393827]()
    printf("checksumFlag: %d\n", checksumFlag);
    [2.2393775]
    [2.2393827]
  • replacement in zstd/contrib/seekable_format/zstdseek_decompress.c at line 328
    [2.2396002][2.2396002:2396045]()
    printf("pos = %d\n", pos);
    [2.2396002]
    [2.2396045]
  • edit in zstd/contrib/seekable_format/zstdseek_decompress.c at line 335
    [2.2396327][2.2396327:2396468]()
    printf("entries[%d].checksum = %x\n",
    idx,
    entries[idx].checksum);
  • edit in zstd/contrib/seekable_format/zstdseek_decompress.c at line 393
    [2.2398612][2.2398612:2398651]()
    printf("Resetting h64\n");
  • replacement in zstd/contrib/seekable_format/zstdseek_decompress.c at line 415
    [2.2399509][2.2399509:2399910]()
    printf("update with");
    for(unsigned long i = prevOutPos; i < outTmp.pos; i++) {
    BYTE* b = (BYTE*) outTmp.dst;
    printf(" %d", b[i]);
    }
    printf("\n%d\n", outTmp.pos - prevOutPos);
    XXH64_update(&zs->xxhState, (BYTE*)outTmp.dst + prevOutPos,
    1); // outTmp.pos - prevOutPos);
    [2.2399509]
    [2.2399910]
    XXH64_update(&zs->xxhState, (BYTE*)outTmp.dst + prevOutPos,
    outTmp.pos - prevOutPos);
  • edit in zstd/contrib/seekable_format/zstdseek_decompress.c at line 424
    [2.2400095][2.2400095:2400194]()
    unsigned long d = XXH64_digest(&zs->xxhState);
    printf("h = %lx\n", d);
  • replacement in zstd/contrib/seekable_format/zstdseek_decompress.c at line 425
    [2.2400244][2.2400244:2400285]()
    (d & 0xFFFFFFFFU) !=
    [2.2400244]
    [2.2400285]
    (XXH64_digest(&zs->xxhState) & 0xFFFFFFFFU) !=
  • edit in zstd/contrib/seekable_format/zstdseek_compress.c at line 66
    [2.2403190]
    [2.2403190]
    // done
  • edit in zstd/contrib/seekable_format/zstdseek_compress.c at line 79
    [2.2403576]
    [2.2403576]
    // done
  • edit in zstd/contrib/seekable_format/zstdseek_compress.c at line 86
    [2.2403691]
    [2.2403691]
    // done
  • edit in zstd/contrib/seekable_format/zstdseek_compress.c at line 105
    [2.2404079]
    [2.2404079]
    // done
  • edit in zstd/contrib/seekable_format/zstdseek_compress.c at line 112
    [2.2404204]
    [2.2404204]
  • edit in zstd/contrib/seekable_format/zstdseek_compress.c at line 114
    [2.2404205]
    [2.2404205]
    // done
  • edit in zstd/contrib/seekable_format/zstdseek_compress.c at line 137
    [2.2404681]
    [2.2404681]
    // done
  • edit in zstd/contrib/seekable_format/zstdseek_compress.c at line 148
    [2.2404923]
    [2.2404923]
    // ~done
  • edit in zstd/contrib/seekable_format/zstdseek_compress.c at line 179
    [2.2405872]
    [2.2405872]
    // done
  • edit in zstd/contrib/seekable_format/zstdseek_compress.c at line 210
    [2.2406825]
    [2.2406825]
    // done
  • edit in zstd/contrib/seekable_format/zstdseek_compress.c at line 243
    [2.2407689]
    [2.2407689]
    // done
  • edit in zstd/contrib/seekable_format/zstdseek_compress.c at line 282
    [2.2408930]
    [2.2408930]
    // done
  • edit in zstd/contrib/seekable_format/zstdseek_compress.c at line 293
    [2.2409270]
    [2.2409270]
    // done
  • edit in zstd/contrib/seekable_format/zstdseek_compress.c at line 313
    [2.2410031]
    [2.2410031]
    // done
  • edit in zstd/contrib/seekable_format/zstdseek_compress.c at line 371
    [2.2412135]
    [2.2412135]
    // done
  • replacement in src/lib.rs at line 494
    [2.2439136][2.2439136:2439166]()
    pub trait Dst: Send + Sized {
    [2.2439136]
    [2.2439166]
    pub trait Dst: Send {
  • edit in src/lib.rs at line 500
    [2.2439292][2.2439292:2439293]()
  • edit in src/lib.rs at line 760
    [2.2447443][2.2447443:2448234]()
    }
    #[test]
    fn pijul_change() {
    let change = include_bytes!("../.pijul/changes/IH/334Q5ACWE4TNQYYOOF6GWV6CRXOEM6542NVNPA6HRIZ3CBFKEAC.change");
    use serde_derive::*;
    #[derive(Deserialize)]
    pub struct Offsets {
    pub version: u64,
    pub hashed_len: u64,
    pub unhashed_off: u64,
    pub unhashed_len: u64,
    pub contents_off: u64,
    pub contents_len: u64,
    pub total: u64,
    }
    let off0 = std::mem::size_of::<Offsets>();
    let offsets: Offsets = bincode::deserialize(&change[..off0]).unwrap();
    let mut s = Seekable::init_buf(
    &change[off0..offsets.unhashed_off as usize],
    ).unwrap();
    let mut buf_ = Vec::new();
    buf_.resize(offsets.hashed_len as usize, 0);
    s.decompress(&mut buf_[..], 0).unwrap();
  • edit in build.rs at line 12
    [2.4445001]
    [2.4445001]
    let out_dir = std::env::var("OUT_DIR").unwrap();
    let out_dirp = std::path::Path::new(&out_dir);
    std::fs::create_dir_all(&out_dir).unwrap();
  • replacement in build.rs at line 18
    [2.4445072][2.4445072:4445137]()
    std::fs::copy("libzstd-win32.lib", "zstd.lib").unwrap();
    [2.4445072]
    [2.4445137]
    std::fs::copy("libzstd-win32.lib", &out_dirp.join("zstd.lib")).unwrap();
  • replacement in build.rs at line 20
    [2.4445192][2.4445192:4445239]()
    println!("cargo:rustc-link-search=.");
    [2.4445192]
    [2.4445239]
    println!("cargo:rustc-link-search={}", out_dir);
  • replacement in build.rs at line 23
    [2.4445363][2.4445363:4445428]()
    std::fs::copy("libzstd-win64.lib", "zstd.lib").unwrap();
    [2.4445363]
    [2.4445428]
    std::fs::copy("libzstd-win64.lib", &out_dirp.join("zstd.lib")).unwrap();
  • replacement in build.rs at line 25
    [2.4445483][2.4445483:4445530]()
    println!("cargo:rustc-link-search=.");
    [2.4445483]
    [2.4445530]
    println!("cargo:rustc-link-search={}", out_dir);
  • edit in build.rs at line 27
    [2.4445577][2.4445577:4445578]()
  • edit in build.rs at line 35
    [2.4445781]
    [2.4445781]
    let options = fs_extra::dir::CopyOptions::new()
    .skip_exist(true);
    let out = out_dirp.join("zstd");
    std::fs::create_dir_all(&out).unwrap();
    fs_extra::dir::copy("zstd/lib", &out, &options).unwrap();
    let dir = out.join("lib");
  • replacement in build.rs at line 42
    [2.4445843][2.4445843:4445884]()
    .current_dir("zstd/lib")
    [2.4445843]
    [2.4445884]
    .current_dir(&dir)
  • replacement in build.rs at line 47
    [2.4446022][2.4446022:4446080]()
    println!("cargo:rustc-link-search=zstd/lib");
    [2.4446022]
    [2.4446080]
    println!("cargo:rustc-link-search={}", dir.display());
  • replacement in Cargo.toml at line 4
    [2.4446680][2.4446680:4446698]()
    version = "0.1.8"
    [2.4446680]
    [2.4446698]
    version = "0.1.10"
  • edit in Cargo.toml at line 106
    [2.4450056][2.4450056:4450101]()
    serde = "*"
    serde_derive = "*"
    bincode = "*"
  • replacement in Cargo.toml at line 109
    [2.4450134][2.4450134:4450152]()
    pkg-config = "0.3"
    [2.4450134]
    pkg-config = "0.3"
    fs_extra = "1.3"
    serde = "1.0"
    serde_derive = "1.0"
    bincode = "1.3"