Example #1
0
        /** ZSTD_ldm_getTableSize() :
         *  Estimate the space needed for long distance matching tables or 0 if LDM is
         *  disabled.
         */
        public static nuint ZSTD_ldm_getTableSize(ldmParams_t @params)
        {
            nuint ldmHSize         = ((nuint)(1)) << (int)@params.hashLog;
            nuint ldmBucketSizeLog = ((@params.bucketSizeLog) < (@params.hashLog) ? (@params.bucketSizeLog) : (@params.hashLog));
            nuint ldmBucketSize    = ((nuint)(1)) << (int)(@params.hashLog - ldmBucketSizeLog);
            nuint totalSize        = ZSTD_cwksp_alloc_size(ldmBucketSize) + ZSTD_cwksp_alloc_size(ldmHSize * (nuint)(8));

            return(@params.enableLdm != 0 ? totalSize : 0);
        }
Example #2
0
        /** ZSTD_ldm_insertEntry() :
         *  Insert the entry with corresponding hash into the hash table */
        private static void ZSTD_ldm_insertEntry(ldmState_t *ldmState, nuint hash, ldmEntry_t entry, ldmParams_t ldmParams)
        {
            byte *pOffset = ldmState->bucketOffsets + hash;
            uint  offset  = *pOffset;

            *(ZSTD_ldm_getBucket(ldmState, hash, ldmParams) + offset) = entry;
            *pOffset = (byte)((offset + 1) & ((1U << (int)ldmParams.bucketSizeLog) - 1));
        }
Example #3
0
 /** ZSTD_ldm_getBucket() :
  *  Returns a pointer to the start of the bucket associated with hash. */
 private static ldmEntry_t *ZSTD_ldm_getBucket(ldmState_t *ldmState, nuint hash, ldmParams_t ldmParams)
 {
     return(ldmState->hashTable + (hash << (int)ldmParams.bucketSizeLog));
 }
Example #4
0
 /** ZSTD_ldm_getSeqSpace() :
  *  Return an upper bound on the number of sequences that can be produced by
  *  the long distance matcher, or 0 if LDM is disabled.
  */
 public static nuint ZSTD_ldm_getMaxNbSeq(ldmParams_t @params, nuint maxChunkSize)
 {
     return(@params.enableLdm != 0 ? (maxChunkSize / @params.minMatchLength) : 0);
 }