]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
fixed debug print macros on Windows
authorYann Collet <yann.collet.73@gmail.com>
Wed, 10 Feb 2016 13:50:22 +0000 (14:50 +0100)
committerYann Collet <yann.collet.73@gmail.com>
Wed, 10 Feb 2016 13:50:22 +0000 (14:50 +0100)
Makefile
NEWS
lib/zstd_opt.c

index e8b797da15d362113003e51e59a586a082edbdce..c80b20f3968b0cb8232abcdbf09c6d6cc3c3228e 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -31,7 +31,7 @@
 # ################################################################
 
 # force a version number : uncomment below export (otherwise, default to the one declared into zstd.h)
-#export VERSION := 0.4.6
+#export VERSION := 0.5.1
 
 PRGDIR  = programs
 ZSTDDIR = lib
diff --git a/NEWS b/NEWS
index 46b170a1058fcdced6c89defcc7d9a5054900608..170f0c824d0226c459b10525f5d9b024b1ee27e3 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,6 @@
+v0.5.1
+New : Optimal parsing => Very high compression modes, thanks to Przemyslaw Skibinski
+
 v0.5.0
 New : dictionary builder utility
 Changed : streaming & dictionary API
index e7ec6dd7c002f1f31f7d416eadbdb03a7607e4a2..1d2315689e3ddb8482d78a1c3914f40b29811674 100644 (file)
@@ -54,6 +54,7 @@ typedef struct {
     U32 rep2;
 } ZSTD_optimal_t;
 
+
 /*-  Constants  -*/
 #define ZSTD_OPT_NUM   (1<<12)
 #define ZSTD_FREQ_THRESHOLD (256)
@@ -61,19 +62,16 @@ typedef struct {
 /*-  Debug  -*/
 #define ZSTD_OPT_DEBUG 0     // 1 = tableID=0;    5 = check encoded sequences
 
-#if 1
-    #define ZSTD_LOG_PARSER(fmt, args...) ;// printf(fmt, ##args)
-    #define ZSTD_LOG_PRICE(fmt, args...) ;//printf(fmt, ##args)
-    #define ZSTD_LOG_ENCODE(fmt, args...) ;//printf(fmt, ##args)
+#if defined(ZSTD_OPT_DEBUG) && ZSTD_OPT_DEBUG>=1
+    #define ZSTD_LOG_PARSER(...) printf(__VA_ARGS__)
+    #define ZSTD_LOG_ENCODE(...) printf(__VA_ARGS__)
+    #define ZSTD_LOG_TRY_PRICE(...) printf(__VA_ARGS__)
 #else
-    #define ZSTD_LOG_PARSER(fmt, args...) printf(fmt, ##args)
-    #define ZSTD_LOG_PRICE(fmt, args...) printf(fmt, ##args)
-    #define ZSTD_LOG_ENCODE(fmt, args...) printf(fmt, ##args)
+    #define ZSTD_LOG_PARSER(...)
+    #define ZSTD_LOG_ENCODE(...)
+    #define ZSTD_LOG_TRY_PRICE(...)
 #endif
 
-#define ZSTD_LOG_TRY_PRICE(fmt, args...) ;//printf(fmt, ##args)
-
-
 
 FORCE_INLINE U32 ZSTD_getLiteralPriceReal(seqStore_t* seqStorePtr, U32 litLength, const BYTE* literals)
 {
@@ -131,7 +129,6 @@ FORCE_INLINE U32 ZSTD_getPrice(seqStore_t* seqStorePtr, U32 litLength, const BYT
 }
 
 
-
 MEM_STATIC void ZSTD_updatePrice(seqStore_t* seqStorePtr, U32 litLength, const BYTE* literals, U32 offset, U32 matchLength)
 {
     U32 u;
@@ -516,7 +513,7 @@ void ZSTD_compressBlock_opt_generic(ZSTD_CCtx* ctx,
        for (u = 0; u < match_num; u++) {
            mlen = (u>0) ? matches[u-1].len+1 : best_mlen;
            best_mlen = (matches[u].len < ZSTD_OPT_NUM) ? matches[u].len : ZSTD_OPT_NUM;
-           ZSTD_LOG_PARSER("%d: start Found mlen=%d off=%d best_mlen=%d last_pos=%d\n", (int)(ip-base), matches[i].len, matches[i].off, (int)best_mlen, (int)last_pos);
+           ZSTD_LOG_PARSER("%d: start Found mlen=%d off=%d best_mlen=%d last_pos=%d\n", (int)(ip-base), matches[u].len, matches[u].off, (int)best_mlen, (int)last_pos);
            litlen = opt[0].litlen;
            while (mlen <= best_mlen)
            {
@@ -585,10 +582,10 @@ void ZSTD_compressBlock_opt_generic(ZSTD_CCtx* ctx,
 
            if (!opt[cur].off && opt[cur].mlen != 1) {
                cur_rep = opt[cur].rep2;
-               ZSTD_LOG_PARSER("%d: try REP2 rep2=%d mlen=%d\n", (int)(inr-base), cur_rep, mlen);
+               ZSTD_LOG_PARSER("%d: try REP2 rep2=%u mlen=%u\n", (int)(inr-base), (U32)cur_rep, mlen);
            } else {
                cur_rep = opt[cur].rep;
-               ZSTD_LOG_PARSER("%d: try REP1 rep=%d mlen=%d\n", (int)(inr-base), cur_rep, mlen);
+               ZSTD_LOG_PARSER("%d: try REP1 rep=%u mlen=%u\n", (int)(inr-base), (U32)cur_rep, mlen);
            }
 
 
@@ -655,7 +652,7 @@ void ZSTD_compressBlock_opt_generic(ZSTD_CCtx* ctx,
                 cur2 = cur - matches[u].back;
                 best_mlen = (cur2 + matches[u].len < ZSTD_OPT_NUM) ? matches[u].len : ZSTD_OPT_NUM - cur2;
 
-                ZSTD_LOG_PARSER("%d: Found1 cur=%d cur2=%d mlen=%d off=%d best_mlen=%d last_pos=%d\n", (int)(inr-base), cur, cur2, matches[u].len, matches[i].off, best_mlen, last_pos);
+                ZSTD_LOG_PARSER("%d: Found1 cur=%d cur2=%d mlen=%d off=%d best_mlen=%d last_pos=%d\n", (int)(inr-base), cur, cur2, matches[u].len, matches[u].off, best_mlen, last_pos);
                 if (mlen < matches[u].back + 1)
                     mlen = matches[u].back + 1;
 
@@ -972,10 +969,10 @@ void ZSTD_compressBlock_opt_extDict_generic(ZSTD_CCtx* ctx,
 
            if (!opt[cur].off && opt[cur].mlen != 1) {
                cur_rep = opt[cur].rep2;
-               ZSTD_LOG_PARSER("%d: try REP2 rep2=%d mlen=%d\n", (int)(inr-base), cur_rep, mlen);
+               ZSTD_LOG_PARSER("%d: try REP2 rep2=%u mlen=%u\n", (int)(inr-base), (U32)cur_rep, mlen);
            } else {
                cur_rep = opt[cur].rep;
-               ZSTD_LOG_PARSER("%d: try REP1 rep=%d mlen=%d\n", (int)(inr-base), cur_rep, mlen);
+               ZSTD_LOG_PARSER("%d: try REP1 rep=%u mlen=%u\n", (int)(inr-base), (U32)cur_rep, mlen);
            }
 
            const U32 repIndex = (U32)(current+cur - cur_rep);
@@ -1082,7 +1079,7 @@ void ZSTD_compressBlock_opt_extDict_generic(ZSTD_CCtx* ctx,
         /* store sequence */
 _storeSequence: // cur, last_pos, best_mlen, best_off have to be set
         for (u = 1; u <= last_pos; u++)
-            ZSTD_LOG_PARSER("%d: price[%d/%d]=%d off=%d mlen=%d litlen=%d rep=%d rep2=%d\n", (int)(ip-base+u), u, last_pos, opt[u].price, opt[u].off, opt[u].mlen, opt[u]litlen, opt[u].rep, opt[u].rep2);
+            ZSTD_LOG_PARSER("%d: price[%u/%d]=%d off=%d mlen=%d litlen=%d rep=%d rep2=%d\n", (int)(ip-base+u), u, last_pos, opt[u].price, opt[u].off, opt[u].mlen, opt[u].litlen, opt[u].rep, opt[u].rep2);
         ZSTD_LOG_PARSER("%d: cur=%d/%d best_mlen=%d best_off=%d rep=%d\n", (int)(ip-base+cur), (int)cur, (int)last_pos, (int)best_mlen, (int)best_off, opt[cur].rep);
 
         opt[0].mlen = 1;