]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
fixed declaration-after-statement warning
authorYann Collet <cyan@fb.com>
Wed, 9 May 2018 19:07:25 +0000 (12:07 -0700)
committerYann Collet <cyan@fb.com>
Wed, 9 May 2018 19:07:25 +0000 (12:07 -0700)
lib/common/fse.h
lib/compress/zstd_opt.c

index 8e44c1a444ed5a1be49c299e42bfedcbfbf30538..864212743d6242186e0c0b7229829effc8e3b0f4 100644 (file)
@@ -582,20 +582,22 @@ MEM_STATIC U32 FSE_getMaxNbBits(const FSE_symbolCompressionTransform* symbolTT,
 
 /* FSE_bitCost_b256() :
  * Approximate symbol cost,
- * provide fractional value, using fixed-point format (accuracyLog fractional bits) */
+ * provide fractional value, using fixed-point format (accuracyLog fractional bits)
+ * note: assume symbolValue is valid */
 MEM_STATIC U32 FSE_bitCost(const FSE_symbolCompressionTransform* symbolTT, U32 tableLog, U32 symbolValue, U32 accuracyLog)
 {
     U32 const minNbBits = symbolTT[symbolValue].deltaNbBits >> 16;
     U32 const threshold = (minNbBits+1) << 16;
     assert(tableLog < 16);
-    U32 const tableSize = 1 << tableLog;
-    assert(symbolTT[symbolValue].deltaNbBits + tableSize <= threshold);
-    U32 const deltaFromThreshold = threshold - (symbolTT[symbolValue].deltaNbBits + tableSize);
     assert(accuracyLog < 31-tableLog);  /* ensure enough room for renormalization double shift */
-    U32 const normalizedDeltaFromThreshold = (deltaFromThreshold << accuracyLog) >> tableLog;   /* linear interpolation (very approximate) */
-    U32 const bitMultiplier = 1 << accuracyLog;
-    assert(normalizedDeltaFromThreshold <= bitMultiplier);
-    return (minNbBits+1)*bitMultiplier - normalizedDeltaFromThreshold;
+    {   U32 const tableSize = 1 << tableLog;
+        assert(symbolTT[symbolValue].deltaNbBits + tableSize <= threshold);
+        {   U32 const deltaFromThreshold = threshold - (symbolTT[symbolValue].deltaNbBits + tableSize);
+            U32 const normalizedDeltaFromThreshold = (deltaFromThreshold << accuracyLog) >> tableLog;   /* linear interpolation (very approximate) */
+            U32 const bitMultiplier = 1 << accuracyLog;
+            assert(normalizedDeltaFromThreshold <= bitMultiplier);
+            return (minNbBits+1)*bitMultiplier - normalizedDeltaFromThreshold;
+    }   }
 }
 
 
index 67db85eb97e4930e7b01f24fbe832be77d57e49a..73ecda721a33ff403cc03582e16c6402b16eeef7 100644 (file)
@@ -135,10 +135,10 @@ static U32 ZSTD_litLengthPrice(U32 const litLength, const optState_t* const optP
         U32 const llCode = ZSTD_LLcode(litLength);
         FSE_CState_t cstate;
         FSE_initCState(&cstate, optPtr->symbolCosts->litlengthCTable);
-        U32 const price = LL_bits[llCode]*BITCOST_MULTIPLIER + BITCOST_SYMBOL(cstate.symbolTT, cstate.stateLog, llCode);
-        DEBUGLOG(8, "ZSTD_litLengthPrice: ll=%u, bitCost=%.2f", litLength, (double)price / BITCOST_MULTIPLIER);
-        return price;
-    }
+        {   U32 const price = LL_bits[llCode]*BITCOST_MULTIPLIER + BITCOST_SYMBOL(cstate.symbolTT, cstate.stateLog, llCode);
+            DEBUGLOG(8, "ZSTD_litLengthPrice: ll=%u, bitCost=%.2f", litLength, (double)price / BITCOST_MULTIPLIER);
+            return price;
+    }   }
     if (optPtr->priceType == zop_predef) return ZSTD_highbit32((U32)litLength+1);
 
     /* dynamic statistics */