LzmaEnc.c -- LZMA Encoder\r
2009-02-02 : Igor Pavlov : Public domain\r
\r
- Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>\r
+ Copyright (c) 2011 - 2016, Intel Corporation. All rights reserved.<BR>\r
This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
which accompanies this distribution. The full text of the license may be found at\r
}\r
}\r
\r
-#define BSR2_RET(pos, res) { UInt32 i = 6 + ((kNumLogBits - 1) & \\r
+#define BSR2_RET(pos, res) { UInt32 ij = 6 + ((kNumLogBits - 1) & \\r
(0 - (((((UInt32)1 << (kNumLogBits + 6)) - 1) - pos) >> 31))); \\r
- res = p->g_FastPos[pos >> i] + (i * 2); }\r
+ res = p->g_FastPos[pos >> ij] + (ij * 2); }\r
/*\r
#define BSR2_RET(pos, res) { res = (pos < (1 << (kNumLogBits + 6))) ? \\r
p->g_FastPos[pos >> 6] + 12 : \\r
#ifdef SHOW_STAT2\r
if (position >= 0)\r
{\r
- unsigned i;\r
+ unsigned ii;\r
printf("\n pos = %4X", position);\r
- for (i = cur; i <= lenEnd; i++)\r
- printf("\nprice[%4X] = %d", position - cur + i, p->opt[i].price);\r
+ for (ii = cur; ii <= lenEnd; ii++)\r
+ printf("\nprice[%4X] = %d", position - cur + ii, p->opt[ii].price);\r
}\r
#endif\r
\r
for (;;)\r
{\r
- UInt32 numAvailFull, newLen, numPairs, posPrev, state, posState, startLen;\r
- UInt32 curPrice, curAnd1Price, matchPrice, repMatchPrice;\r
+ UInt32 numAvailFull, newLen, posPrev, state, startLen;\r
+ UInt32 curPrice, curAnd1Price;\r
Bool nextIsChar;\r
- Byte curByte, matchByte;\r
- const Byte *data;\r
COptimal *curOpt;\r
COptimal *nextOpt;\r
\r
prevOpt = &p->opt[posPrev];\r
if (pos < LZMA_NUM_REPS)\r
{\r
- UInt32 i;\r
reps[0] = prevOpt->backs[pos];\r
for (i = 1; i <= pos; i++)\r
reps[i] = prevOpt->backs[i - 1];\r
}\r
else\r
{\r
- UInt32 i;\r
reps[0] = (pos - LZMA_NUM_REPS);\r
for (i = 1; i < LZMA_NUM_REPS; i++)\r
reps[i] = prevOpt->backs[i - 1];\r
GET_PRICE_1(p->isRep[state2]);\r
/* for (; lenTest2 >= 2; lenTest2--) */\r
{\r
- UInt32 curAndLenPrice;\r
COptimal *opt;\r
UInt32 offset = cur + 1 + lenTest2;\r
while (lenEnd < offset)\r
p->opt[++lenEnd].price = kInfinityPrice;\r
- curAndLenPrice = nextRepMatchPrice + GetRepPrice(p, 0, lenTest2, state2, posStateNext);\r
+ UInt32 curAndLenPrice = nextRepMatchPrice + GetRepPrice(p, 0, lenTest2, state2, posStateNext);\r
opt = &p->opt[offset];\r
if (curAndLenPrice < opt->price)\r
{\r
}\r
if (newLen >= startLen)\r
{\r
- UInt32 normalMatchPrice = matchPrice + GET_PRICE_0(p->isRep[state]);\r
+ normalMatchPrice = matchPrice + GET_PRICE_0(p->isRep[state]);\r
UInt32 offs, curBack, posSlot;\r
UInt32 lenTest;\r
while (lenEnd < cur + newLen)\r
GetPosSlot2(curBack, posSlot);\r
for (lenTest = /*2*/ startLen; ; lenTest++)\r
{\r
- UInt32 curAndLenPrice = normalMatchPrice + p->lenEnc.prices[posState][lenTest - LZMA_MATCH_LEN_MIN];\r
+ UInt32 curAndLenPrice;\r
+ curAndLenPrice = normalMatchPrice + p->lenEnc.prices[posState][lenTest - LZMA_MATCH_LEN_MIN];\r
UInt32 lenToPosState = GetLenToPosState(lenTest);\r
COptimal *opt;\r
if (curBack < kNumFullDistances)\r
/* for (; lenTest2 >= 2; lenTest2--) */\r
{\r
UInt32 offset = cur + lenTest + 1 + lenTest2;\r
- UInt32 curAndLenPrice;\r
- COptimal *opt;\r
+\r
while (lenEnd < offset)\r
p->opt[++lenEnd].price = kInfinityPrice;\r
curAndLenPrice = nextRepMatchPrice + GetRepPrice(p, 0, lenTest2, state2, posStateNext);\r
\r
{\r
UInt32 *distancesPrices = p->distancesPrices[lenToPosState];\r
- UInt32 i;\r
+\r
for (i = 0; i < kStartPosModelIndex; i++)\r
distancesPrices[i] = posSlotPrices[i];\r
for (; i < kNumFullDistances; i++)\r