]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
code formatting
authorinikep <inikep@gmail.com>
Tue, 5 Apr 2016 19:30:03 +0000 (21:30 +0200)
committerinikep <inikep@gmail.com>
Tue, 5 Apr 2016 19:30:03 +0000 (21:30 +0200)
lib/zstd_compress.c
lib/zstd_opt.h

index 544323ce315281189a56eb50684569a39eadc579..caf4b975536dbf03be4bb50e07e9aa15b020a2a0 100644 (file)
@@ -2184,7 +2184,7 @@ typedef void (*ZSTD_blockCompressor) (ZSTD_CCtx* ctx, const void* src, size_t sr
 static ZSTD_blockCompressor ZSTD_selectBlockCompressor(ZSTD_strategy strat, int extDict)
 {
     static const ZSTD_blockCompressor blockCompressor[2][6] = {
-#if 1
+#if 0
         { ZSTD_compressBlock_fast, ZSTD_compressBlock_greedy, ZSTD_compressBlock_lazy, ZSTD_compressBlock_lazy2, ZSTD_compressBlock_btlazy2, ZSTD_compressBlock_btopt },
 #else
         { ZSTD_compressBlock_fast_extDict, ZSTD_compressBlock_greedy_extDict, ZSTD_compressBlock_lazy_extDict,ZSTD_compressBlock_lazy2_extDict, ZSTD_compressBlock_btlazy2_extDict, ZSTD_compressBlock_btopt_extDict },
index 7b59399d2b1e1a69666a1acd22243b760a6fb232..f477ae7b65837aa9a62fe2e32dc2c704631024fb 100644 (file)
@@ -796,24 +796,24 @@ void ZSTD_compressBlock_opt_extDict_generic(ZSTD_CCtx* ctx,
                 } while (mlen >= minMatch);
         }   }
 
-       best_mlen = (last_pos) ? last_pos : minMatch;
+        best_mlen = (last_pos) ? last_pos : minMatch;
 
-       match_num = ZSTD_BtGetAllMatches_selectMLS_extDict(ctx, ip, iend, maxSearches, mls, matches);  /* first search (depth 0) */
+        match_num = ZSTD_BtGetAllMatches_selectMLS_extDict(ctx, ip, iend, maxSearches, mls, matches);  /* first search (depth 0) */
 
-       ZSTD_LOG_PARSER("%d: match_num=%d last_pos=%d\n", (int)(ip-base), match_num, last_pos);
-       if (!last_pos && !match_num) { ip++; continue; }
+        ZSTD_LOG_PARSER("%d: match_num=%d last_pos=%d\n", (int)(ip-base), match_num, last_pos);
+        if (!last_pos && !match_num) { ip++; continue; }
 
-       for (int i=0; i<ZSTD_REP_INIT; i++)
+        for (int i=0; i<ZSTD_REP_INIT; i++)
             opt[0].rep[i] = rep[i];
-       opt[0].mlen = 1;
+        opt[0].mlen = 1;
 
-       if (match_num && matches[match_num-1].len > sufficient_len) {
+        if (match_num && matches[match_num-1].len > sufficient_len) {
             best_mlen = matches[match_num-1].len;
             best_off = matches[match_num-1].off;
             cur = 0;
             last_pos = 1;
             goto _storeSequence;
-       }
+        }
 
         // set prices using matches at position = 0
         for (u = 0; u < match_num; u++) {
@@ -870,7 +870,6 @@ void ZSTD_compressBlock_opt_extDict_generic(ZSTD_CCtx* ctx,
             }
 
             ZSTD_LOG_PARSER("%d: CURRENT_NoExt price[%d/%d]=%d off=%d mlen=%d litlen=%d rep=%d rep[1]=%d\n", (int)(inr-base), cur, last_pos, opt[cur].price, opt[cur].off, opt[cur].mlen, opt[cur].litlen, opt[cur].rep[0], opt[cur].rep[1]);
-
             best_mlen = 0;
 
             for (U32 i=0; i<ZSTD_REP_NUM; i++) {
@@ -885,10 +884,8 @@ void ZSTD_compressBlock_opt_extDict_generic(ZSTD_CCtx* ctx,
                     ZSTD_LOG_PARSER("%d: Found REP mlen=%d off=%d rep=%d opt[%d].off=%d\n", (int)(inr-base), mlen, 0, opt[cur].rep, cur, opt[cur].off);
 
                     if (mlen > sufficient_len || cur + mlen >= ZSTD_OPT_NUM) {
-                        best_mlen = mlen;
-                        best_off = i;
                         ZSTD_LOG_PARSER("%d: REP sufficient_len=%d best_mlen=%d best_off=%d last_pos=%d\n", (int)(inr-base), sufficient_len, best_mlen, best_off, last_pos);
-                        last_pos = cur + 1;
+                        best_mlen = mlen; best_off = i; last_pos = cur + 1;
                         goto _storeSequence;
                     }
 
@@ -914,8 +911,6 @@ void ZSTD_compressBlock_opt_extDict_generic(ZSTD_CCtx* ctx,
                     } while (mlen >= minMatch);
             }   }
 
-            best_mlen = (best_mlen > minMatch) ? best_mlen : minMatch;
-
             match_num = ZSTD_BtGetAllMatches_selectMLS_extDict(ctx, inr, iend, maxSearches, mls, matches);
             ZSTD_LOG_PARSER("%d: ZSTD_GetAllMatches match_num=%d\n", (int)(inr-base), match_num);
 
@@ -926,6 +921,8 @@ void ZSTD_compressBlock_opt_extDict_generic(ZSTD_CCtx* ctx,
                 goto _storeSequence;
             }
 
+            best_mlen = (best_mlen > minMatch) ? best_mlen : minMatch;
+
             // set prices using matches at position = cur
             for (u = 0; u < match_num; u++) {
                 mlen = (u>0) ? matches[u-1].len+1 : best_mlen;