From 4154aec679e98b76c3e19ccdcb105e89faf9af37 Mon Sep 17 00:00:00 2001
From: Yann Collet
#define ZSTD_COMPRESSBOUND(srcSize) ((srcSize) + ((srcSize)>>8) + (((srcSize) < 128 KB) ? ((128 KB - (srcSize)) >> 11)/* margin, from 64 to 0 */ : 0)) /* this formula ensures that bound(A) + bound(B) <= bound(A+B) as long as A and B >= 128 KB */ +
#define ZSTD_COMPRESSBOUND(srcSize) ((srcSize) + ((srcSize)>>8) + (((srcSize) < (128<<10)) ? (((128<<10) - (srcSize)) >> 11)/* margin, from 64 to 0 */ : 0)) /* this formula ensures that bound(A) + bound(B) <= bound(A+B) as long as A and B >= 128 KB */ size_t ZSTD_compressBound(size_t srcSize); /*!< maximum compressed size in worst case scenario */ unsigned ZSTD_isError(size_t code); /*!< tells if a `size_t` function result is an error code */ const char* ZSTD_getErrorName(size_t code); /*!< provides readable string from an error code */ @@ -906,7 +906,8 @@ size_t ZSTD_decodingBufferSize_min(unsigned long long windowSize, unsigned long
size_t ZSTD_CCtx_setParameter(ZSTD_CCtx* cctx, ZSTD_cParameter param, unsigned value);Set one compression parameter, selected by enum ZSTD_cParameter. Note : when `value` is an enum, cast it to unsigned for proper type checking. - @result : 0, or an error code (which can be tested with ZSTD_isError()). + @result : informational value (typically, the one being set, possibly corrected), + or an error code (which can be tested with ZSTD_isError()).
size_t ZSTD_CCtx_setPledgedSrcSize(ZSTD_CCtx* cctx, unsigned long long pledgedSrcSize); diff --git a/lib/compress/zstd_opt.c b/lib/compress/zstd_opt.c index b9a2cf85..1defcb8f 100644 --- a/lib/compress/zstd_opt.c +++ b/lib/compress/zstd_opt.c @@ -606,7 +606,8 @@ size_t ZSTD_compressBlock_opt_generic(ZSTD_CCtx* ctx, } else { if (optLevel==0) break; /* gets ~+10% speed for about -0.01 ratio loss */ } - } } } } + } } } + } /* for (cur = 1; cur <= last_pos; cur++) */ best_mlen = opt[last_pos].mlen; best_off = opt[last_pos].off; @@ -661,7 +662,7 @@ _shortestPath: /* cur, last_pos, best_mlen, best_off have to be set */ anchor = ip; } } ZSTD_setLog2Prices(optStatePtr); - } /* for (cur=0; cur < last_pos; ) */ + } while (ip < ilimit) /* Save reps for next block */ { int i; for (i=0; irepToConfirm[i] = rep[i]; }