From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail.byosoft.com.cn (mail.byosoft.com.cn [58.240.74.242]) by mx.groups.io with SMTP id smtpd.web11.247.1610114091705227265 for ; Fri, 08 Jan 2021 05:54:54 -0800 Authentication-Results: mx.groups.io; dkim=missing; spf=none, err=permanent DNS error (domain: byosoft.com.cn, ip: 58.240.74.242, mailfrom: gaoliming@byosoft.com.cn) Received: from DESKTOPS6D0PVI ([101.86.139.221]) (envelope-sender ) by 192.168.6.13 with ESMTP for ; Fri, 08 Jan 2021 21:54:40 +0800 X-WM-Sender: gaoliming@byosoft.com.cn X-WM-AuthFlag: YES X-WM-AuthUser: gaoliming@byosoft.com.cn From: "gaoliming" To: , References: <20210105061403.1309-1-weix.c.liu@intel.com> In-Reply-To: <20210105061403.1309-1-weix.c.liu@intel.com> Subject: =?UTF-8?B?5Zue5aSNOiBbZWRrMi1kZXZlbF0gW1BBVENIIDEvMl0gQmFzZVRvb2xzIEx6bWFDb21wcmVzczogVXBkYXRlIExaTUEgdG8gbmV3IDE5LjAwIHZlcnNpb24=?= Date: Fri, 8 Jan 2021 21:54:34 +0800 Message-ID: <007201d6e5c5$d235d670$76a18350$@byosoft.com.cn> MIME-Version: 1.0 X-Mailer: Microsoft Outlook 16.0 Thread-Index: AQJ7B9AXxpyV/D7CzstLxWSyDjY7M6jVe9eQ Content-Type: text/plain; charset="gb2312" Content-Transfer-Encoding: quoted-printable Content-Language: zh-cn Reviewed-by: Liming Gao Merged https://github.com/tianocore/edk2/pull/1272 Thanks Liming > -----=D3=CA=BC=FE=D4=AD=BC=FE----- > =B7=A2=BC=FE=C8=CB: bounce+27952+69675+4905953+8761045@groups.io > =B4=FA=B1=ED Liu, WeiX = C > =B7=A2=CB=CD=CA=B1=BC=E4: 2021=C4=EA1=D4=C25=C8=D5 14:14 > =CA=D5=BC=FE=C8=CB: devel@edk2.groups.io > =B3=AD=CB=CD: Wei Liu ; Liming Gao > > =D6=F7=CC=E2: [edk2-devel] [PATCH 1/2] BaseTools LzmaCompress: Update = LZMA to > new 19.00 version >=20 > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D3101 > New formal release in https://www.7-zip.org/sdk.html is 19.00. >=20 > Cc: Liming Gao > Signed-off-by: Wei Liu > --- > BaseTools/Source/C/LzmaCompress/LZMA-SDK-README.txt | 4 > ++-- > BaseTools/Source/C/LzmaCompress/LzmaCompress.c | 8 > ++++---- > BaseTools/Source/C/LzmaCompress/Sdk/C/7zTypes.h | 5 > +++-- > BaseTools/Source/C/LzmaCompress/Sdk/C/7zVersion.h | 8 > ++++---- > BaseTools/Source/C/LzmaCompress/Sdk/C/CpuArch.h | 9 > +++++---- > BaseTools/Source/C/LzmaCompress/Sdk/C/LzFind.c | 232 > ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ > ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ > +++++++++++++++++++++----------------------------------------------------= --- ------- > ------------------------- > BaseTools/Source/C/LzmaCompress/Sdk/C/LzFindMt.c | 117 > ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ > +++++++++++++------------------------------------------ > BaseTools/Source/C/LzmaCompress/Sdk/C/LzFindMt.h | 14 > +++++++------- > BaseTools/Source/C/LzmaCompress/Sdk/C/LzmaDec.c | 32 > ++++++++++++++++---------------- > BaseTools/Source/C/LzmaCompress/Sdk/C/LzmaEnc.c | 907 > ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ > ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ > ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ > ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ > ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ > ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ > ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ > ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ > +++++++++++++++++++++++++++++++++++++++++++++++++++----------------- > -------------------------------------------------------------------------= --- ----------------- > -------------------------------------------------------------------------= --- ----------------- > -------------------------------------------------------------------------= --- ----------------- > ---------------------------------------------------------------- > BaseTools/Source/C/LzmaCompress/Sdk/DOC/lzma-history.txt | 114 > ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ > ++++++---------------------------------------------- > BaseTools/Source/C/LzmaCompress/Sdk/DOC/lzma-sdk.txt | 2 +- > 12 files changed, 877 insertions(+), 575 deletions(-) >=20 > diff --git a/BaseTools/Source/C/LzmaCompress/LZMA-SDK-README.txt > b/BaseTools/Source/C/LzmaCompress/LZMA-SDK-README.txt > index 7cf967a774..b2338e2598 100644 > --- a/BaseTools/Source/C/LzmaCompress/LZMA-SDK-README.txt > +++ b/BaseTools/Source/C/LzmaCompress/LZMA-SDK-README.txt > @@ -1,3 +1,3 @@ > -LzmaCompress is based on the LZMA SDK 18.05. LZMA SDK 18.05 >=20 > -was placed in the public domain on 2018-04-30. It was >=20 > +LzmaCompress is based on the LZMA SDK 19.00. LZMA SDK 19.00 >=20 > +was placed in the public domain on 2019-02-21. It was >=20 > released on the http://www.7-zip.org/sdk.html website. >=20 > diff --git a/BaseTools/Source/C/LzmaCompress/LzmaCompress.c > b/BaseTools/Source/C/LzmaCompress/LzmaCompress.c > index bebdb9aa84..bf4706ee23 100644 > --- a/BaseTools/Source/C/LzmaCompress/LzmaCompress.c > +++ b/BaseTools/Source/C/LzmaCompress/LzmaCompress.c > @@ -1,9 +1,9 @@ > /** @file >=20 > LZMA Compress/Decompress tool (LzmaCompress) >=20 >=20 >=20 > - Based on LZMA SDK 18.05: >=20 > + Based on LZMA SDK 19.00: >=20 > LzmaUtil.c -- Test application for LZMA compression >=20 > - 2018-04-30 : Igor Pavlov : Public domain >=20 > + 2019-02-21 : Igor Pavlov : Public domain >=20 >=20 >=20 > Copyright (c) 2006 - 2019, Intel Corporation. All rights = reserved.
>=20 > SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > @@ -39,7 +39,7 @@ const char *kCantAllocateMessage =3D "Can not = allocate > memory"; > const char *kDataErrorMessage =3D "Data error"; >=20 > const char *kInvalidParamValMessage =3D "Invalid parameter value"; >=20 >=20 >=20 > -static Bool mQuietMode =3D False; >=20 > +static BoolInt mQuietMode =3D False; >=20 > static CONVERTER_TYPE mConType =3D NoConverter; >=20 >=20 >=20 > UINT64 mDictionarySize =3D 28; >=20 > @@ -244,7 +244,7 @@ int main2(int numArgs, const char *args[], char = *rs) > CFileOutStream outStream; >=20 > int res; >=20 > int encodeMode =3D 0; >=20 > - Bool modeWasSet =3D False; >=20 > + BoolInt modeWasSet =3D False; >=20 > const char *inputFile =3D NULL; >=20 > const char *outputFile =3D "file.tmp"; >=20 > int param; >=20 > diff --git a/BaseTools/Source/C/LzmaCompress/Sdk/C/7zTypes.h > b/BaseTools/Source/C/LzmaCompress/Sdk/C/7zTypes.h > index 4977cdaa66..593f5aa259 100644 > --- a/BaseTools/Source/C/LzmaCompress/Sdk/C/7zTypes.h > +++ b/BaseTools/Source/C/LzmaCompress/Sdk/C/7zTypes.h > @@ -1,5 +1,5 @@ > /* 7zTypes.h -- Basic types >=20 > -2017-07-17 : Igor Pavlov : Public domain */ >=20 > +2018-08-04 : Igor Pavlov : Public domain */ >=20 >=20 >=20 > #ifndef __7Z_TYPES_H >=20 > #define __7Z_TYPES_H >=20 > @@ -103,7 +103,8 @@ typedef UInt32 SizeT; > typedef size_t SizeT; >=20 > #endif >=20 >=20 >=20 > -typedef int Bool; >=20 > +typedef int BoolInt; >=20 > +/* typedef BoolInt Bool; */ >=20 > #define True 1 >=20 > #define False 0 >=20 >=20 >=20 > diff --git a/BaseTools/Source/C/LzmaCompress/Sdk/C/7zVersion.h > b/BaseTools/Source/C/LzmaCompress/Sdk/C/7zVersion.h > index ed3aa94270..0074c64be9 100644 > --- a/BaseTools/Source/C/LzmaCompress/Sdk/C/7zVersion.h > +++ b/BaseTools/Source/C/LzmaCompress/Sdk/C/7zVersion.h > @@ -1,7 +1,7 @@ > -#define MY_VER_MAJOR 18 >=20 > -#define MY_VER_MINOR 05 >=20 > +#define MY_VER_MAJOR 19 >=20 > +#define MY_VER_MINOR 00 >=20 > #define MY_VER_BUILD 0 >=20 > -#define MY_VERSION_NUMBERS "18.05" >=20 > +#define MY_VERSION_NUMBERS "19.00" >=20 > #define MY_VERSION MY_VERSION_NUMBERS >=20 >=20 >=20 > #ifdef MY_CPU_NAME >=20 > @@ -10,7 +10,7 @@ > #define MY_VERSION_CPU MY_VERSION >=20 > #endif >=20 >=20 >=20 > -#define MY_DATE "2018-04-30" >=20 > +#define MY_DATE "2019-02-21" >=20 > #undef MY_COPYRIGHT >=20 > #undef MY_VERSION_COPYRIGHT_DATE >=20 > #define MY_AUTHOR_NAME "Igor Pavlov" >=20 > diff --git a/BaseTools/Source/C/LzmaCompress/Sdk/C/CpuArch.h > b/BaseTools/Source/C/LzmaCompress/Sdk/C/CpuArch.h > index 7fb27282c7..5f74c1c0cb 100644 > --- a/BaseTools/Source/C/LzmaCompress/Sdk/C/CpuArch.h > +++ b/BaseTools/Source/C/LzmaCompress/Sdk/C/CpuArch.h > @@ -1,5 +1,5 @@ > /* CpuArch.h -- CPU specific code >=20 > -2017-09-04 : Igor Pavlov : Public domain */ >=20 > +2018-02-18 : Igor Pavlov : Public domain */ >=20 >=20 >=20 > #ifndef __CPU_ARCH_H >=20 > #define __CPU_ARCH_H >=20 > @@ -318,15 +318,16 @@ enum >=20 >=20 > void MyCPUID(UInt32 function, UInt32 *a, UInt32 *b, UInt32 *c, UInt32 *d); >=20 >=20 >=20 > -Bool x86cpuid_CheckAndRead(Cx86cpuid *p); >=20 > +BoolInt x86cpuid_CheckAndRead(Cx86cpuid *p); >=20 > int x86cpuid_GetFirm(const Cx86cpuid *p); >=20 >=20 >=20 > #define x86cpuid_GetFamily(ver) (((ver >> 16) & 0xFF0) | ((ver >> 8) = & 0xF)) >=20 > #define x86cpuid_GetModel(ver) (((ver >> 12) & 0xF0) | ((ver >> 4) = & > 0xF)) >=20 > #define x86cpuid_GetStepping(ver) (ver & 0xF) >=20 >=20 >=20 > -Bool CPU_Is_InOrder(); >=20 > -Bool CPU_Is_Aes_Supported(); >=20 > +BoolInt CPU_Is_InOrder(); >=20 > +BoolInt CPU_Is_Aes_Supported(); >=20 > +BoolInt CPU_IsSupported_PageGB(); >=20 >=20 >=20 > #endif >=20 >=20 >=20 > diff --git a/BaseTools/Source/C/LzmaCompress/Sdk/C/LzFind.c > b/BaseTools/Source/C/LzmaCompress/Sdk/C/LzFind.c > index 6ea82a9b53..f89c9ddd7d 100644 > --- a/BaseTools/Source/C/LzmaCompress/Sdk/C/LzFind.c > +++ b/BaseTools/Source/C/LzmaCompress/Sdk/C/LzFind.c > @@ -1,5 +1,5 @@ > /* LzFind.c -- Match finder for LZ algorithms >=20 > -2017-06-10 : Igor Pavlov : Public domain */ >=20 > +2018-07-08 : Igor Pavlov : Public domain */ >=20 >=20 >=20 > #include "Precomp.h" >=20 >=20 >=20 > @@ -73,7 +73,7 @@ static void MatchFinder_ReadBlock(CMatchFinder *p) > p->streamEndWasReached =3D 1; >=20 > return; >=20 > } >=20 > - >=20 > + >=20 > for (;;) >=20 > { >=20 > Byte *dest =3D p->buffer + (p->streamPos - p->pos); >=20 > @@ -138,7 +138,7 @@ static void > MatchFinder_SetDefaultSettings(CMatchFinder *p) >=20 >=20 > void MatchFinder_Construct(CMatchFinder *p) >=20 > { >=20 > - UInt32 i; >=20 > + unsigned i; >=20 > p->bufferBase =3D NULL; >=20 > p->directInput =3D 0; >=20 > p->hash =3D NULL; >=20 > @@ -147,7 +147,7 @@ void MatchFinder_Construct(CMatchFinder *p) >=20 >=20 > for (i =3D 0; i < 256; i++) >=20 > { >=20 > - UInt32 r =3D i; >=20 > + UInt32 r =3D (UInt32)i; >=20 > unsigned j; >=20 > for (j =3D 0; j < 8; j++) >=20 > r =3D (r >> 1) ^ (kCrcPoly & ((UInt32)0 - (r & 1))); >=20 > @@ -180,24 +180,24 @@ int MatchFinder_Create(CMatchFinder *p, UInt32 > historySize, > ISzAllocPtr alloc) >=20 > { >=20 > UInt32 sizeReserv; >=20 > - >=20 > + >=20 > if (historySize > kMaxHistorySize) >=20 > { >=20 > MatchFinder_Free(p, alloc); >=20 > return 0; >=20 > } >=20 > - >=20 > + >=20 > sizeReserv =3D historySize >> 1; >=20 > if (historySize >=3D ((UInt32)3 << 30)) sizeReserv =3D = historySize >> 3; >=20 > else if (historySize >=3D ((UInt32)2 << 30)) sizeReserv =3D = historySize >> 2; >=20 > - >=20 > + >=20 > sizeReserv +=3D (keepAddBufferBefore + matchMaxLen + > keepAddBufferAfter) / 2 + (1 << 19); >=20 >=20 >=20 > p->keepSizeBefore =3D historySize + keepAddBufferBefore + 1; >=20 > p->keepSizeAfter =3D matchMaxLen + keepAddBufferAfter; >=20 > - >=20 > + >=20 > /* we need one additional byte, since we use MoveBlock after pos++ = and > before dictionary using */ >=20 > - >=20 > + >=20 > if (LzInWindow_Create(p, sizeReserv, alloc)) >=20 > { >=20 > UInt32 newCyclicBufferSize =3D historySize + 1; >=20 > @@ -243,7 +243,7 @@ int MatchFinder_Create(CMatchFinder *p, UInt32 > historySize, > p->historySize =3D historySize; >=20 > p->hashSizeSum =3D hs; >=20 > p->cyclicBufferSize =3D newCyclicBufferSize; >=20 > - >=20 > + >=20 > numSons =3D newCyclicBufferSize; >=20 > if (p->btMode) >=20 > numSons <<=3D 1; >=20 > @@ -251,11 +251,11 @@ int MatchFinder_Create(CMatchFinder *p, UInt32 > historySize, >=20 >=20 > if (p->hash && p->numRefs =3D=3D newSize) >=20 > return 1; >=20 > - >=20 > + >=20 > MatchFinder_FreeThisClassMemory(p, alloc); >=20 > p->numRefs =3D newSize; >=20 > p->hash =3D AllocRefs(newSize, alloc); >=20 > - >=20 > + >=20 > if (p->hash) >=20 > { >=20 > p->son =3D p->hash + p->hashSizeSum; >=20 > @@ -272,11 +272,11 @@ static void MatchFinder_SetLimits(CMatchFinder > *p) > { >=20 > UInt32 limit =3D kMaxValForNormalize - p->pos; >=20 > UInt32 limit2 =3D p->cyclicBufferSize - p->cyclicBufferPos; >=20 > - >=20 > + >=20 > if (limit2 < limit) >=20 > limit =3D limit2; >=20 > limit2 =3D p->streamPos - p->pos; >=20 > - >=20 > + >=20 > if (limit2 <=3D p->keepSizeAfter) >=20 > { >=20 > if (limit2 > 0) >=20 > @@ -284,10 +284,10 @@ static void MatchFinder_SetLimits(CMatchFinder > *p) > } >=20 > else >=20 > limit2 -=3D p->keepSizeAfter; >=20 > - >=20 > + >=20 > if (limit2 < limit) >=20 > limit =3D limit2; >=20 > - >=20 > + >=20 > { >=20 > UInt32 lenLimit =3D p->streamPos - p->pos; >=20 > if (lenLimit > p->matchMaxLen) >=20 > @@ -326,10 +326,10 @@ void MatchFinder_Init_3(CMatchFinder *p, int > readData) > p->streamPos =3D p->cyclicBufferSize; >=20 > p->result =3D SZ_OK; >=20 > p->streamEndWasReached =3D 0; >=20 > - >=20 > + >=20 > if (readData) >=20 > MatchFinder_ReadBlock(p); >=20 > - >=20 > + >=20 > MatchFinder_SetLimits(p); >=20 > } >=20 >=20 >=20 > @@ -341,7 +341,7 @@ void MatchFinder_Init(CMatchFinder *p) > MatchFinder_Init_3(p, True); >=20 > } >=20 >=20 >=20 > - >=20 > + >=20 > static UInt32 MatchFinder_GetSubValue(CMatchFinder *p) >=20 > { >=20 > return (p->pos - p->historySize - 1) & kNormalizeMask; >=20 > @@ -368,6 +368,8 @@ static void MatchFinder_Normalize(CMatchFinder *p) > MatchFinder_ReduceOffsets(p, subValue); >=20 > } >=20 >=20 >=20 > + >=20 > +MY_NO_INLINE >=20 > static void MatchFinder_CheckLimits(CMatchFinder *p) >=20 > { >=20 > if (p->pos =3D=3D kMaxValForNormalize) >=20 > @@ -379,10 +381,16 @@ static void > MatchFinder_CheckLimits(CMatchFinder *p) > MatchFinder_SetLimits(p); >=20 > } >=20 >=20 >=20 > -static UInt32 * Hc_GetMatchesSpec(UInt32 lenLimit, UInt32 curMatch, > UInt32 pos, const Byte *cur, CLzRef *son, >=20 > + >=20 > +/* >=20 > + (lenLimit > maxLen) >=20 > +*/ >=20 > +MY_FORCE_INLINE >=20 > +static UInt32 * Hc_GetMatchesSpec(unsigned lenLimit, UInt32 curMatch, > UInt32 pos, const Byte *cur, CLzRef *son, >=20 > UInt32 _cyclicBufferPos, UInt32 _cyclicBufferSize, UInt32 = cutValue, >=20 > - UInt32 *distances, UInt32 maxLen) >=20 > + UInt32 *distances, unsigned maxLen) >=20 > { >=20 > + /* >=20 > son[_cyclicBufferPos] =3D curMatch; >=20 > for (;;) >=20 > { >=20 > @@ -400,7 +408,8 @@ static UInt32 * Hc_GetMatchesSpec(UInt32 lenLimit, > UInt32 curMatch, UInt32 pos, > break; >=20 > if (maxLen < len) >=20 > { >=20 > - *distances++ =3D maxLen =3D len; >=20 > + maxLen =3D len; >=20 > + *distances++ =3D len; >=20 > *distances++ =3D delta - 1; >=20 > if (len =3D=3D lenLimit) >=20 > return distances; >=20 > @@ -408,15 +417,58 @@ static UInt32 * Hc_GetMatchesSpec(UInt32 > lenLimit, UInt32 curMatch, UInt32 pos, > } >=20 > } >=20 > } >=20 > + */ >=20 > + >=20 > + const Byte *lim =3D cur + lenLimit; >=20 > + son[_cyclicBufferPos] =3D curMatch; >=20 > + do >=20 > + { >=20 > + UInt32 delta =3D pos - curMatch; >=20 > + if (delta >=3D _cyclicBufferSize) >=20 > + break; >=20 > + { >=20 > + ptrdiff_t diff; >=20 > + curMatch =3D son[_cyclicBufferPos - delta + ((delta > _cyclicBufferPos) ? > _cyclicBufferSize : 0)]; >=20 > + diff =3D (ptrdiff_t)0 - delta; >=20 > + if (cur[maxLen] =3D=3D cur[maxLen + diff]) >=20 > + { >=20 > + const Byte *c =3D cur; >=20 > + while (*c =3D=3D c[diff]) >=20 > + { >=20 > + if (++c =3D=3D lim) >=20 > + { >=20 > + distances[0] =3D (UInt32)(lim - cur); >=20 > + distances[1] =3D delta - 1; >=20 > + return distances + 2; >=20 > + } >=20 > + } >=20 > + { >=20 > + unsigned len =3D (unsigned)(c - cur); >=20 > + if (maxLen < len) >=20 > + { >=20 > + maxLen =3D len; >=20 > + distances[0] =3D (UInt32)len; >=20 > + distances[1] =3D delta - 1; >=20 > + distances +=3D 2; >=20 > + } >=20 > + } >=20 > + } >=20 > + } >=20 > + } >=20 > + while (--cutValue); >=20 > + >=20 > + return distances; >=20 > } >=20 >=20 >=20 > + >=20 > +MY_FORCE_INLINE >=20 > UInt32 * GetMatchesSpec1(UInt32 lenLimit, UInt32 curMatch, UInt32 = pos, > const Byte *cur, CLzRef *son, >=20 > UInt32 _cyclicBufferPos, UInt32 _cyclicBufferSize, UInt32 = cutValue, >=20 > UInt32 *distances, UInt32 maxLen) >=20 > { >=20 > - CLzRef *ptr0 =3D son + (_cyclicBufferPos << 1) + 1; >=20 > - CLzRef *ptr1 =3D son + (_cyclicBufferPos << 1); >=20 > - UInt32 len0 =3D 0, len1 =3D 0; >=20 > + CLzRef *ptr0 =3D son + ((size_t)_cyclicBufferPos << 1) + 1; >=20 > + CLzRef *ptr1 =3D son + ((size_t)_cyclicBufferPos << 1); >=20 > + unsigned len0 =3D 0, len1 =3D 0; >=20 > for (;;) >=20 > { >=20 > UInt32 delta =3D pos - curMatch; >=20 > @@ -426,9 +478,10 @@ UInt32 * GetMatchesSpec1(UInt32 lenLimit, UInt32 > curMatch, UInt32 pos, const Byt > return distances; >=20 > } >=20 > { >=20 > - CLzRef *pair =3D son + ((_cyclicBufferPos - delta + ((delta > > _cyclicBufferPos) ? _cyclicBufferSize : 0)) << 1); >=20 > + CLzRef *pair =3D son + ((size_t)(_cyclicBufferPos - delta + = ((delta > > _cyclicBufferPos) ? _cyclicBufferSize : 0)) << 1); >=20 > const Byte *pb =3D cur - delta; >=20 > - UInt32 len =3D (len0 < len1 ? len0 : len1); >=20 > + unsigned len =3D (len0 < len1 ? len0 : len1); >=20 > + UInt32 pair0 =3D pair[0]; >=20 > if (pb[len] =3D=3D cur[len]) >=20 > { >=20 > if (++len !=3D lenLimit && pb[len] =3D=3D cur[len]) >=20 > @@ -437,11 +490,12 @@ UInt32 * GetMatchesSpec1(UInt32 lenLimit, > UInt32 curMatch, UInt32 pos, const Byt > break; >=20 > if (maxLen < len) >=20 > { >=20 > - *distances++ =3D maxLen =3D len; >=20 > + maxLen =3D (UInt32)len; >=20 > + *distances++ =3D (UInt32)len; >=20 > *distances++ =3D delta - 1; >=20 > if (len =3D=3D lenLimit) >=20 > { >=20 > - *ptr1 =3D pair[0]; >=20 > + *ptr1 =3D pair0; >=20 > *ptr0 =3D pair[1]; >=20 > return distances; >=20 > } >=20 > @@ -468,9 +522,9 @@ UInt32 * GetMatchesSpec1(UInt32 lenLimit, UInt32 > curMatch, UInt32 pos, const Byt > static void SkipMatchesSpec(UInt32 lenLimit, UInt32 curMatch, UInt32 = pos, > const Byte *cur, CLzRef *son, >=20 > UInt32 _cyclicBufferPos, UInt32 _cyclicBufferSize, UInt32 = cutValue) >=20 > { >=20 > - CLzRef *ptr0 =3D son + (_cyclicBufferPos << 1) + 1; >=20 > - CLzRef *ptr1 =3D son + (_cyclicBufferPos << 1); >=20 > - UInt32 len0 =3D 0, len1 =3D 0; >=20 > + CLzRef *ptr0 =3D son + ((size_t)_cyclicBufferPos << 1) + 1; >=20 > + CLzRef *ptr1 =3D son + ((size_t)_cyclicBufferPos << 1); >=20 > + unsigned len0 =3D 0, len1 =3D 0; >=20 > for (;;) >=20 > { >=20 > UInt32 delta =3D pos - curMatch; >=20 > @@ -480,9 +534,9 @@ static void SkipMatchesSpec(UInt32 lenLimit, = UInt32 > curMatch, UInt32 pos, const > return; >=20 > } >=20 > { >=20 > - CLzRef *pair =3D son + ((_cyclicBufferPos - delta + ((delta > > _cyclicBufferPos) ? _cyclicBufferSize : 0)) << 1); >=20 > + CLzRef *pair =3D son + ((size_t)(_cyclicBufferPos - delta + = ((delta > > _cyclicBufferPos) ? _cyclicBufferSize : 0)) << 1); >=20 > const Byte *pb =3D cur - delta; >=20 > - UInt32 len =3D (len0 < len1 ? len0 : len1); >=20 > + unsigned len =3D (len0 < len1 ? len0 : len1); >=20 > if (pb[len] =3D=3D cur[len]) >=20 > { >=20 > while (++len !=3D lenLimit) >=20 > @@ -520,13 +574,13 @@ static void SkipMatchesSpec(UInt32 lenLimit, > UInt32 curMatch, UInt32 pos, const > p->buffer++; \ >=20 > if (++p->pos =3D=3D p->posLimit) MatchFinder_CheckLimits(p); >=20 >=20 >=20 > -#define MOVE_POS_RET MOVE_POS return offset; >=20 > +#define MOVE_POS_RET MOVE_POS return (UInt32)offset; >=20 >=20 >=20 > static void MatchFinder_MovePos(CMatchFinder *p) { MOVE_POS; } >=20 >=20 >=20 > #define GET_MATCHES_HEADER2(minLen, ret_op) \ >=20 > - UInt32 lenLimit; UInt32 hv; const Byte *cur; UInt32 curMatch; \ >=20 > - lenLimit =3D p->lenLimit; { if (lenLimit < minLen) { MatchFinder_MovePos(p); > ret_op; }} \ >=20 > + unsigned lenLimit; UInt32 hv; const Byte *cur; UInt32 curMatch; \ >=20 > + lenLimit =3D (unsigned)p->lenLimit; { if (lenLimit < minLen) > { MatchFinder_MovePos(p); ret_op; }} \ >=20 > cur =3D p->buffer; >=20 >=20 >=20 > #define GET_MATCHES_HEADER(minLen) GET_MATCHES_HEADER2(minLen, > return 0) >=20 > @@ -535,22 +589,22 @@ static void MatchFinder_MovePos(CMatchFinder > *p) { MOVE_POS; } > #define MF_PARAMS(p) p->pos, p->buffer, p->son, p->cyclicBufferPos, > p->cyclicBufferSize, p->cutValue >=20 >=20 >=20 > #define GET_MATCHES_FOOTER(offset, maxLen) \ >=20 > - offset =3D (UInt32)(GetMatchesSpec1(lenLimit, curMatch, = MF_PARAMS(p), \ >=20 > - distances + offset, maxLen) - distances); MOVE_POS_RET; >=20 > + offset =3D (unsigned)(GetMatchesSpec1((UInt32)lenLimit, curMatch, > MF_PARAMS(p), \ >=20 > + distances + offset, (UInt32)maxLen) - distances); MOVE_POS_RET; >=20 >=20 >=20 > #define SKIP_FOOTER \ >=20 > - SkipMatchesSpec(lenLimit, curMatch, MF_PARAMS(p)); MOVE_POS; >=20 > + SkipMatchesSpec((UInt32)lenLimit, curMatch, MF_PARAMS(p)); > MOVE_POS; >=20 >=20 >=20 > #define UPDATE_maxLen { \ >=20 > ptrdiff_t diff =3D (ptrdiff_t)0 - d2; \ >=20 > const Byte *c =3D cur + maxLen; \ >=20 > const Byte *lim =3D cur + lenLimit; \ >=20 > for (; c !=3D lim; c++) if (*(c + diff) !=3D *c) break; \ >=20 > - maxLen =3D (UInt32)(c - cur); } >=20 > + maxLen =3D (unsigned)(c - cur); } >=20 >=20 >=20 > static UInt32 Bt2_MatchFinder_GetMatches(CMatchFinder *p, UInt32 > *distances) >=20 > { >=20 > - UInt32 offset; >=20 > + unsigned offset; >=20 > GET_MATCHES_HEADER(2) >=20 > HASH2_CALC; >=20 > curMatch =3D p->hash[hv]; >=20 > @@ -561,7 +615,7 @@ static UInt32 > Bt2_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances) >=20 >=20 > UInt32 Bt3Zip_MatchFinder_GetMatches(CMatchFinder *p, UInt32 > *distances) >=20 > { >=20 > - UInt32 offset; >=20 > + unsigned offset; >=20 > GET_MATCHES_HEADER(3) >=20 > HASH_ZIP_CALC; >=20 > curMatch =3D p->hash[hv]; >=20 > @@ -572,7 +626,8 @@ UInt32 > Bt3Zip_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances) >=20 >=20 > static UInt32 Bt3_MatchFinder_GetMatches(CMatchFinder *p, UInt32 > *distances) >=20 > { >=20 > - UInt32 h2, d2, maxLen, offset, pos; >=20 > + UInt32 h2, d2, pos; >=20 > + unsigned maxLen, offset; >=20 > UInt32 *hash; >=20 > GET_MATCHES_HEADER(3) >=20 >=20 >=20 > @@ -584,7 +639,7 @@ static UInt32 > Bt3_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances) > d2 =3D pos - hash[h2]; >=20 >=20 >=20 > curMatch =3D (hash + kFix3HashSize)[hv]; >=20 > - >=20 > + >=20 > hash[h2] =3D pos; >=20 > (hash + kFix3HashSize)[hv] =3D pos; >=20 >=20 >=20 > @@ -594,22 +649,23 @@ static UInt32 > Bt3_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances) > if (d2 < p->cyclicBufferSize && *(cur - d2) =3D=3D *cur) >=20 > { >=20 > UPDATE_maxLen >=20 > - distances[0] =3D maxLen; >=20 > + distances[0] =3D (UInt32)maxLen; >=20 > distances[1] =3D d2 - 1; >=20 > offset =3D 2; >=20 > if (maxLen =3D=3D lenLimit) >=20 > { >=20 > - SkipMatchesSpec(lenLimit, curMatch, MF_PARAMS(p)); >=20 > + SkipMatchesSpec((UInt32)lenLimit, curMatch, MF_PARAMS(p)); >=20 > MOVE_POS_RET; >=20 > } >=20 > } >=20 > - >=20 > + >=20 > GET_MATCHES_FOOTER(offset, maxLen) >=20 > } >=20 >=20 >=20 > static UInt32 Bt4_MatchFinder_GetMatches(CMatchFinder *p, UInt32 > *distances) >=20 > { >=20 > - UInt32 h2, h3, d2, d3, maxLen, offset, pos; >=20 > + UInt32 h2, h3, d2, d3, pos; >=20 > + unsigned maxLen, offset; >=20 > UInt32 *hash; >=20 > GET_MATCHES_HEADER(4) >=20 >=20 >=20 > @@ -618,25 +674,26 @@ static UInt32 > Bt4_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances) > hash =3D p->hash; >=20 > pos =3D p->pos; >=20 >=20 >=20 > - d2 =3D pos - hash[ h2]; >=20 > + d2 =3D pos - hash [h2]; >=20 > d3 =3D pos - (hash + kFix3HashSize)[h3]; >=20 >=20 >=20 > curMatch =3D (hash + kFix4HashSize)[hv]; >=20 >=20 >=20 > - hash[ h2] =3D pos; >=20 > + hash [h2] =3D pos; >=20 > (hash + kFix3HashSize)[h3] =3D pos; >=20 > (hash + kFix4HashSize)[hv] =3D pos; >=20 >=20 >=20 > maxLen =3D 0; >=20 > offset =3D 0; >=20 > - >=20 > + >=20 > if (d2 < p->cyclicBufferSize && *(cur - d2) =3D=3D *cur) >=20 > { >=20 > - distances[0] =3D maxLen =3D 2; >=20 > + maxLen =3D 2; >=20 > + distances[0] =3D 2; >=20 > distances[1] =3D d2 - 1; >=20 > offset =3D 2; >=20 > } >=20 > - >=20 > + >=20 > if (d2 !=3D d3 && d3 < p->cyclicBufferSize && *(cur - d3) =3D=3D = *cur) >=20 > { >=20 > maxLen =3D 3; >=20 > @@ -644,21 +701,21 @@ static UInt32 > Bt4_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances) > offset +=3D 2; >=20 > d2 =3D d3; >=20 > } >=20 > - >=20 > + >=20 > if (offset !=3D 0) >=20 > { >=20 > UPDATE_maxLen >=20 > - distances[(size_t)offset - 2] =3D maxLen; >=20 > + distances[(size_t)offset - 2] =3D (UInt32)maxLen; >=20 > if (maxLen =3D=3D lenLimit) >=20 > { >=20 > - SkipMatchesSpec(lenLimit, curMatch, MF_PARAMS(p)); >=20 > + SkipMatchesSpec((UInt32)lenLimit, curMatch, MF_PARAMS(p)); >=20 > MOVE_POS_RET; >=20 > } >=20 > } >=20 > - >=20 > + >=20 > if (maxLen < 3) >=20 > maxLen =3D 3; >=20 > - >=20 > + >=20 > GET_MATCHES_FOOTER(offset, maxLen) >=20 > } >=20 >=20 >=20 > @@ -674,13 +731,13 @@ static UInt32 > Bt5_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances) > hash =3D p->hash; >=20 > pos =3D p->pos; >=20 >=20 >=20 > - d2 =3D pos - hash[ h2]; >=20 > + d2 =3D pos - hash [h2]; >=20 > d3 =3D pos - (hash + kFix3HashSize)[h3]; >=20 > d4 =3D pos - (hash + kFix4HashSize)[h4]; >=20 >=20 >=20 > curMatch =3D (hash + kFix5HashSize)[hv]; >=20 >=20 >=20 > - hash[ h2] =3D pos; >=20 > + hash [h2] =3D pos; >=20 > (hash + kFix3HashSize)[h3] =3D pos; >=20 > (hash + kFix4HashSize)[h4] =3D pos; >=20 > (hash + kFix5HashSize)[hv] =3D pos; >=20 > @@ -710,7 +767,7 @@ static UInt32 > Bt5_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances) > offset =3D 2; >=20 > d2 =3D d3; >=20 > } >=20 > - >=20 > + >=20 > if (d2 !=3D d4 && d4 < p->cyclicBufferSize >=20 > && *(cur - d4) =3D=3D *cur >=20 > && *(cur - d4 + 3) =3D=3D *(cur + 3)) >=20 > @@ -720,7 +777,7 @@ static UInt32 > Bt5_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances) > offset +=3D 2; >=20 > d2 =3D d4; >=20 > } >=20 > - >=20 > + >=20 > if (offset !=3D 0) >=20 > { >=20 > UPDATE_maxLen >=20 > @@ -734,14 +791,15 @@ static UInt32 > Bt5_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances) >=20 >=20 > if (maxLen < 4) >=20 > maxLen =3D 4; >=20 > - >=20 > + >=20 > GET_MATCHES_FOOTER(offset, maxLen) >=20 > } >=20 > */ >=20 >=20 >=20 > static UInt32 Hc4_MatchFinder_GetMatches(CMatchFinder *p, UInt32 > *distances) >=20 > { >=20 > - UInt32 h2, h3, d2, d3, maxLen, offset, pos; >=20 > + UInt32 h2, h3, d2, d3, pos; >=20 > + unsigned maxLen, offset; >=20 > UInt32 *hash; >=20 > GET_MATCHES_HEADER(4) >=20 >=20 >=20 > @@ -749,13 +807,12 @@ static UInt32 > Hc4_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances) >=20 >=20 > hash =3D p->hash; >=20 > pos =3D p->pos; >=20 > - >=20 > - d2 =3D pos - hash[ h2]; >=20 > + >=20 > + d2 =3D pos - hash [h2]; >=20 > d3 =3D pos - (hash + kFix3HashSize)[h3]; >=20 > - >=20 > curMatch =3D (hash + kFix4HashSize)[hv]; >=20 >=20 >=20 > - hash[ h2] =3D pos; >=20 > + hash [h2] =3D pos; >=20 > (hash + kFix3HashSize)[h3] =3D pos; >=20 > (hash + kFix4HashSize)[hv] =3D pos; >=20 >=20 >=20 > @@ -764,11 +821,12 @@ static UInt32 > Hc4_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances) >=20 >=20 > if (d2 < p->cyclicBufferSize && *(cur - d2) =3D=3D *cur) >=20 > { >=20 > - distances[0] =3D maxLen =3D 2; >=20 > + maxLen =3D 2; >=20 > + distances[0] =3D 2; >=20 > distances[1] =3D d2 - 1; >=20 > offset =3D 2; >=20 > } >=20 > - >=20 > + >=20 > if (d2 !=3D d3 && d3 < p->cyclicBufferSize && *(cur - d3) =3D=3D = *cur) >=20 > { >=20 > maxLen =3D 3; >=20 > @@ -776,22 +834,22 @@ static UInt32 > Hc4_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances) > offset +=3D 2; >=20 > d2 =3D d3; >=20 > } >=20 > - >=20 > + >=20 > if (offset !=3D 0) >=20 > { >=20 > UPDATE_maxLen >=20 > - distances[(size_t)offset - 2] =3D maxLen; >=20 > + distances[(size_t)offset - 2] =3D (UInt32)maxLen; >=20 > if (maxLen =3D=3D lenLimit) >=20 > { >=20 > p->son[p->cyclicBufferPos] =3D curMatch; >=20 > MOVE_POS_RET; >=20 > } >=20 > } >=20 > - >=20 > + >=20 > if (maxLen < 3) >=20 > maxLen =3D 3; >=20 >=20 >=20 > - offset =3D (UInt32)(Hc_GetMatchesSpec(lenLimit, curMatch, = MF_PARAMS(p), >=20 > + offset =3D (unsigned)(Hc_GetMatchesSpec(lenLimit, curMatch, > MF_PARAMS(p), >=20 > distances + offset, maxLen) - (distances)); >=20 > MOVE_POS_RET >=20 > } >=20 > @@ -807,14 +865,14 @@ static UInt32 > Hc5_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances) >=20 >=20 > hash =3D p->hash; >=20 > pos =3D p->pos; >=20 > - >=20 > - d2 =3D pos - hash[ h2]; >=20 > + >=20 > + d2 =3D pos - hash [h2]; >=20 > d3 =3D pos - (hash + kFix3HashSize)[h3]; >=20 > d4 =3D pos - (hash + kFix4HashSize)[h4]; >=20 >=20 >=20 > curMatch =3D (hash + kFix5HashSize)[hv]; >=20 >=20 >=20 > - hash[ h2] =3D pos; >=20 > + hash [h2] =3D pos; >=20 > (hash + kFix3HashSize)[h3] =3D pos; >=20 > (hash + kFix4HashSize)[h4] =3D pos; >=20 > (hash + kFix5HashSize)[hv] =3D pos; >=20 > @@ -844,7 +902,7 @@ static UInt32 > Hc5_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances) > offset =3D 2; >=20 > d2 =3D d3; >=20 > } >=20 > - >=20 > + >=20 > if (d2 !=3D d4 && d4 < p->cyclicBufferSize >=20 > && *(cur - d4) =3D=3D *cur >=20 > && *(cur - d4 + 3) =3D=3D *(cur + 3)) >=20 > @@ -854,7 +912,7 @@ static UInt32 > Hc5_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances) > offset +=3D 2; >=20 > d2 =3D d4; >=20 > } >=20 > - >=20 > + >=20 > if (offset !=3D 0) >=20 > { >=20 > UPDATE_maxLen >=20 > @@ -865,7 +923,7 @@ static UInt32 > Hc5_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances) > MOVE_POS_RET; >=20 > } >=20 > } >=20 > - >=20 > + >=20 > if (maxLen < 4) >=20 > maxLen =3D 4; >=20 >=20 >=20 > @@ -877,12 +935,12 @@ static UInt32 > Hc5_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances) >=20 >=20 > UInt32 Hc3Zip_MatchFinder_GetMatches(CMatchFinder *p, UInt32 > *distances) >=20 > { >=20 > - UInt32 offset; >=20 > + unsigned offset; >=20 > GET_MATCHES_HEADER(3) >=20 > HASH_ZIP_CALC; >=20 > curMatch =3D p->hash[hv]; >=20 > p->hash[hv] =3D p->pos; >=20 > - offset =3D (UInt32)(Hc_GetMatchesSpec(lenLimit, curMatch, = MF_PARAMS(p), >=20 > + offset =3D (unsigned)(Hc_GetMatchesSpec(lenLimit, curMatch, > MF_PARAMS(p), >=20 > distances, 2) - (distances)); >=20 > MOVE_POS_RET >=20 > } >=20 > @@ -940,7 +998,7 @@ static void Bt4_MatchFinder_Skip(CMatchFinder *p, > UInt32 num) > HASH4_CALC; >=20 > hash =3D p->hash; >=20 > curMatch =3D (hash + kFix4HashSize)[hv]; >=20 > - hash[ h2] =3D >=20 > + hash [h2] =3D >=20 > (hash + kFix3HashSize)[h3] =3D >=20 > (hash + kFix4HashSize)[hv] =3D p->pos; >=20 > SKIP_FOOTER >=20 > @@ -959,7 +1017,7 @@ static void Bt5_MatchFinder_Skip(CMatchFinder *p, > UInt32 num) > HASH5_CALC; >=20 > hash =3D p->hash; >=20 > curMatch =3D (hash + kFix5HashSize)[hv]; >=20 > - hash[ h2] =3D >=20 > + hash [h2] =3D >=20 > (hash + kFix3HashSize)[h3] =3D >=20 > (hash + kFix4HashSize)[h4] =3D >=20 > (hash + kFix5HashSize)[hv] =3D p->pos; >=20 > @@ -979,7 +1037,7 @@ static void Hc4_MatchFinder_Skip(CMatchFinder *p, > UInt32 num) > HASH4_CALC; >=20 > hash =3D p->hash; >=20 > curMatch =3D (hash + kFix4HashSize)[hv]; >=20 > - hash[ h2] =3D >=20 > + hash [h2] =3D >=20 > (hash + kFix3HashSize)[h3] =3D >=20 > (hash + kFix4HashSize)[hv] =3D p->pos; >=20 > p->son[p->cyclicBufferPos] =3D curMatch; >=20 > @@ -999,7 +1057,7 @@ static void Hc5_MatchFinder_Skip(CMatchFinder *p, > UInt32 num) > HASH5_CALC; >=20 > hash =3D p->hash; >=20 > curMatch =3D hash + kFix5HashSize)[hv]; >=20 > - hash[ h2] =3D >=20 > + hash [h2] =3D >=20 > (hash + kFix3HashSize)[h3] =3D >=20 > (hash + kFix4HashSize)[h4] =3D >=20 > (hash + kFix5HashSize)[hv] =3D p->pos; >=20 > diff --git a/BaseTools/Source/C/LzmaCompress/Sdk/C/LzFindMt.c > b/BaseTools/Source/C/LzmaCompress/Sdk/C/LzFindMt.c > index 2563824fcd..df32146f92 100644 > --- a/BaseTools/Source/C/LzmaCompress/Sdk/C/LzFindMt.c > +++ b/BaseTools/Source/C/LzmaCompress/Sdk/C/LzFindMt.c > @@ -1,5 +1,5 @@ > /* LzFindMt.c -- multithreaded Match finder for LZ algorithms >=20 > -2017-06-10 : Igor Pavlov : Public domain */ >=20 > +2018-12-29 : Igor Pavlov : Public domain */ >=20 >=20 >=20 > #include "Precomp.h" >=20 >=20 >=20 > @@ -232,38 +232,57 @@ static void > MatchFinderMt_GetNextBlock_Hash(CMatchFinderMt *p) >=20 >=20 > #define kEmptyHashValue 0 >=20 >=20 >=20 > -/* #define MFMT_GM_INLINE */ >=20 > +#define MFMT_GM_INLINE >=20 >=20 >=20 > #ifdef MFMT_GM_INLINE >=20 >=20 >=20 > -#define NO_INLINE MY_FAST_CALL >=20 > +/* >=20 > + we use size_t for _cyclicBufferPos instead of UInt32 >=20 > + to eliminate "movsx" BUG in old MSVC x64 compiler. >=20 > +*/ >=20 >=20 >=20 > -static Int32 NO_INLINE GetMatchesSpecN(UInt32 lenLimit, UInt32 pos, > const Byte *cur, CLzRef *son, >=20 > - UInt32 _cyclicBufferPos, UInt32 _cyclicBufferSize, UInt32 = _cutValue, >=20 > - UInt32 *_distances, UInt32 _maxLen, const UInt32 *hash, Int32 = limit, > UInt32 size, UInt32 *posRes) >=20 > +MY_NO_INLINE >=20 > +static UInt32 *GetMatchesSpecN(UInt32 lenLimit, UInt32 pos, const = Byte > *cur, CLzRef *son, >=20 > + size_t _cyclicBufferPos, UInt32 _cyclicBufferSize, UInt32 = _cutValue, >=20 > + UInt32 *distances, UInt32 _maxLen, const UInt32 *hash, const = UInt32 > *limit, UInt32 size, UInt32 *posRes) >=20 > { >=20 > do >=20 > { >=20 > - UInt32 *distances =3D _distances + 1; >=20 > - UInt32 curMatch =3D pos - *hash++; >=20 > + UInt32 *_distances =3D ++distances; >=20 > + UInt32 delta =3D *hash++; >=20 >=20 >=20 > - CLzRef *ptr0 =3D son + (_cyclicBufferPos << 1) + 1; >=20 > - CLzRef *ptr1 =3D son + (_cyclicBufferPos << 1); >=20 > - UInt32 len0 =3D 0, len1 =3D 0; >=20 > + CLzRef *ptr0 =3D son + ((size_t)_cyclicBufferPos << 1) + 1; >=20 > + CLzRef *ptr1 =3D son + ((size_t)_cyclicBufferPos << 1); >=20 > + unsigned len0 =3D 0, len1 =3D 0; >=20 > UInt32 cutValue =3D _cutValue; >=20 > - UInt32 maxLen =3D _maxLen; >=20 > - for (;;) >=20 > + unsigned maxLen =3D (unsigned)_maxLen; >=20 > + >=20 > + /* >=20 > + if (size > 1) >=20 > { >=20 > - UInt32 delta =3D pos - curMatch; >=20 > - if (cutValue-- =3D=3D 0 || delta >=3D _cyclicBufferSize) >=20 > + UInt32 delta =3D *hash; >=20 > + if (delta < _cyclicBufferSize) >=20 > { >=20 > - *ptr0 =3D *ptr1 =3D kEmptyHashValue; >=20 > - break; >=20 > + UInt32 cyc1 =3D _cyclicBufferPos + 1; >=20 > + CLzRef *pair =3D son + ((size_t)(cyc1 - delta + ((delta > cyc1) = ? > _cyclicBufferSize : 0)) << 1); >=20 > + Byte b =3D *(cur + 1 - delta); >=20 > + _distances[0] =3D pair[0]; >=20 > + _distances[1] =3D b; >=20 > } >=20 > + } >=20 > + */ >=20 > + if (cutValue =3D=3D 0 || delta >=3D _cyclicBufferSize) >=20 > + { >=20 > + *ptr0 =3D *ptr1 =3D kEmptyHashValue; >=20 > + } >=20 > + else >=20 > + for(;;) >=20 > + { >=20 > { >=20 > - CLzRef *pair =3D son + ((_cyclicBufferPos - delta + ((delta > > _cyclicBufferPos) ? _cyclicBufferSize : 0)) << 1); >=20 > + CLzRef *pair =3D son + ((size_t)(_cyclicBufferPos - delta + > ((_cyclicBufferPos < delta) ? _cyclicBufferSize : 0)) << 1); >=20 > const Byte *pb =3D cur - delta; >=20 > - UInt32 len =3D (len0 < len1 ? len0 : len1); >=20 > + unsigned len =3D (len0 < len1 ? len0 : len1); >=20 > + UInt32 pair0 =3D *pair; >=20 > if (pb[len] =3D=3D cur[len]) >=20 > { >=20 > if (++len !=3D lenLimit && pb[len] =3D=3D cur[len]) >=20 > @@ -272,54 +291,66 @@ static Int32 NO_INLINE GetMatchesSpecN(UInt32 > lenLimit, UInt32 pos, const Byte * > break; >=20 > if (maxLen < len) >=20 > { >=20 > - *distances++ =3D maxLen =3D len; >=20 > + maxLen =3D len; >=20 > + *distances++ =3D (UInt32)len; >=20 > *distances++ =3D delta - 1; >=20 > if (len =3D=3D lenLimit) >=20 > { >=20 > - *ptr1 =3D pair[0]; >=20 > - *ptr0 =3D pair[1]; >=20 > + UInt32 pair1 =3D pair[1]; >=20 > + *ptr1 =3D pair0; >=20 > + *ptr0 =3D pair1; >=20 > break; >=20 > } >=20 > } >=20 > } >=20 > - if (pb[len] < cur[len]) >=20 > - { >=20 > - *ptr1 =3D curMatch; >=20 > - ptr1 =3D pair + 1; >=20 > - curMatch =3D *ptr1; >=20 > - len1 =3D len; >=20 > - } >=20 > - else >=20 > { >=20 > - *ptr0 =3D curMatch; >=20 > - ptr0 =3D pair; >=20 > - curMatch =3D *ptr0; >=20 > - len0 =3D len; >=20 > + UInt32 curMatch =3D pos - delta; >=20 > + // delta =3D pos - *pair; >=20 > + // delta =3D pos - pair[((UInt32)pb[len] - (UInt32)cur[len]) = >> 31]; >=20 > + if (pb[len] < cur[len]) >=20 > + { >=20 > + delta =3D pos - pair[1]; >=20 > + *ptr1 =3D curMatch; >=20 > + ptr1 =3D pair + 1; >=20 > + len1 =3D len; >=20 > + } >=20 > + else >=20 > + { >=20 > + delta =3D pos - *pair; >=20 > + *ptr0 =3D curMatch; >=20 > + ptr0 =3D pair; >=20 > + len0 =3D len; >=20 > + } >=20 > } >=20 > } >=20 > + if (--cutValue =3D=3D 0 || delta >=3D _cyclicBufferSize) >=20 > + { >=20 > + *ptr0 =3D *ptr1 =3D kEmptyHashValue; >=20 > + break; >=20 > + } >=20 > } >=20 > pos++; >=20 > _cyclicBufferPos++; >=20 > cur++; >=20 > { >=20 > UInt32 num =3D (UInt32)(distances - _distances); >=20 > - *_distances =3D num - 1; >=20 > - _distances +=3D num; >=20 > - limit -=3D num; >=20 > + _distances[-1] =3D num; >=20 > } >=20 > } >=20 > - while (limit > 0 && --size !=3D 0); >=20 > + while (distances < limit && --size !=3D 0); >=20 > *posRes =3D pos; >=20 > - return limit; >=20 > + return distances; >=20 > } >=20 >=20 >=20 > #endif >=20 >=20 >=20 > + >=20 > + >=20 > static void BtGetMatches(CMatchFinderMt *p, UInt32 *distances) >=20 > { >=20 > UInt32 numProcessed =3D 0; >=20 > UInt32 curPos =3D 2; >=20 > - UInt32 limit =3D kMtBtBlockSize - (p->matchMaxLen * 2); >=20 > + UInt32 limit =3D kMtBtBlockSize - (p->matchMaxLen * 2); // * 2 >=20 >=20 >=20 > distances[1] =3D p->hashNumAvail; >=20 >=20 >=20 > @@ -369,8 +400,10 @@ static void BtGetMatches(CMatchFinderMt *p, > UInt32 *distances) > #else >=20 > { >=20 > UInt32 posRes; >=20 > - curPos =3D limit - GetMatchesSpecN(lenLimit, pos, p->buffer, p->son, > cyclicBufferPos, p->cyclicBufferSize, p->cutValue, >=20 > - distances + curPos, p->numHashBytes - 1, p->hashBuf + > p->hashBufPos, (Int32)(limit - curPos), size, &posRes); >=20 > + curPos =3D (UInt32)(GetMatchesSpecN(lenLimit, pos, p->buffer, > p->son, cyclicBufferPos, p->cyclicBufferSize, p->cutValue, >=20 > + distances + curPos, p->numHashBytes - 1, p->hashBuf + > p->hashBufPos, >=20 > + distances + limit, >=20 > + size, &posRes) - distances); >=20 > p->hashBufPos +=3D posRes - pos; >=20 > cyclicBufferPos +=3D posRes - pos; >=20 > p->buffer +=3D posRes - pos; >=20 > diff --git a/BaseTools/Source/C/LzmaCompress/Sdk/C/LzFindMt.h > b/BaseTools/Source/C/LzmaCompress/Sdk/C/LzFindMt.h > index 3d86c788f3..fdd17008c2 100644 > --- a/BaseTools/Source/C/LzmaCompress/Sdk/C/LzFindMt.h > +++ b/BaseTools/Source/C/LzmaCompress/Sdk/C/LzFindMt.h > @@ -1,5 +1,5 @@ > /* LzFindMt.h -- multithreaded Match finder for LZ algorithms >=20 > -2017-04-03 : Igor Pavlov : Public domain */ >=20 > +2018-07-04 : Igor Pavlov : Public domain */ >=20 >=20 >=20 > #ifndef __LZ_FIND_MT_H >=20 > #define __LZ_FIND_MT_H >=20 > @@ -19,10 +19,10 @@ EXTERN_C_BEGIN >=20 >=20 > typedef struct _CMtSync >=20 > { >=20 > - Bool wasCreated; >=20 > - Bool needStart; >=20 > - Bool exit; >=20 > - Bool stopWriting; >=20 > + BoolInt wasCreated; >=20 > + BoolInt needStart; >=20 > + BoolInt exit; >=20 > + BoolInt stopWriting; >=20 >=20 >=20 > CThread thread; >=20 > CAutoResetEvent canStart; >=20 > @@ -30,8 +30,8 @@ typedef struct _CMtSync > CAutoResetEvent wasStopped; >=20 > CSemaphore freeSemaphore; >=20 > CSemaphore filledSemaphore; >=20 > - Bool csWasInitialized; >=20 > - Bool csWasEntered; >=20 > + BoolInt csWasInitialized; >=20 > + BoolInt csWasEntered; >=20 > CCriticalSection cs; >=20 > UInt32 numProcessedBlocks; >=20 > } CMtSync; >=20 > diff --git a/BaseTools/Source/C/LzmaCompress/Sdk/C/LzmaDec.c > b/BaseTools/Source/C/LzmaCompress/Sdk/C/LzmaDec.c > index 962b94bb63..4d1576419f 100644 > --- a/BaseTools/Source/C/LzmaCompress/Sdk/C/LzmaDec.c > +++ b/BaseTools/Source/C/LzmaCompress/Sdk/C/LzmaDec.c > @@ -1,13 +1,13 @@ > /* LzmaDec.c -- LZMA Decoder >=20 > -2018-02-28 : Igor Pavlov : Public domain */ >=20 > +2018-07-04 : Igor Pavlov : Public domain */ >=20 >=20 >=20 > #include "Precomp.h" >=20 >=20 >=20 > +#include >=20 > + >=20 > /* #include "CpuArch.h" */ >=20 > #include "LzmaDec.h" >=20 >=20 >=20 > -#include >=20 > - >=20 > #define kNumTopBits 24 >=20 > #define kTopValue ((UInt32)1 << kNumTopBits) >=20 >=20 >=20 > @@ -19,7 +19,7 @@ >=20 >=20 > #define NORMALIZE if (range < kTopValue) { range <<=3D 8; code =3D = (code << 8) > | (*buf++); } >=20 >=20 >=20 > -#define IF_BIT_0(p) ttt =3D *(p); NORMALIZE; bound =3D (range >> > kNumBitModelTotalBits) * ttt; if (code < bound) >=20 > +#define IF_BIT_0(p) ttt =3D *(p); NORMALIZE; bound =3D (range >> > kNumBitModelTotalBits) * (UInt32)ttt; if (code < bound) >=20 > #define UPDATE_0(p) range =3D bound; *(p) =3D (CLzmaProb)(ttt + > ((kBitModelTotal - ttt) >> kNumMoveBits)); >=20 > #define UPDATE_1(p) range -=3D bound; code -=3D bound; *(p) =3D = (CLzmaProb)(ttt > - (ttt >> kNumMoveBits)); >=20 > #define GET_BIT2(p, i, A0, A1) IF_BIT_0(p) \ >=20 > @@ -66,7 +66,7 @@ >=20 >=20 > #define NORMALIZE_CHECK if (range < kTopValue) { if (buf >=3D = bufLimit) > return DUMMY_ERROR; range <<=3D 8; code =3D (code << 8) | (*buf++); } >=20 >=20 >=20 > -#define IF_BIT_0_CHECK(p) ttt =3D *(p); NORMALIZE_CHECK; bound =3D = (range >> > kNumBitModelTotalBits) * ttt; if (code < bound) >=20 > +#define IF_BIT_0_CHECK(p) ttt =3D *(p); NORMALIZE_CHECK; bound =3D = (range >> > kNumBitModelTotalBits) * (UInt32)ttt; if (code < bound) >=20 > #define UPDATE_0_CHECK range =3D bound; >=20 > #define UPDATE_1_CHECK range -=3D bound; code -=3D bound; >=20 > #define GET_BIT2_CHECK(p, i, A0, A1) IF_BIT_0_CHECK(p) \ >=20 > @@ -539,7 +539,7 @@ int MY_FAST_CALL LZMA_DECODE_REAL(CLzmaDec > *p, SizeT limit, const Byte *bufLimit > curLen =3D ((rem < len) ? (unsigned)rem : len); >=20 > pos =3D dicPos - rep0 + (dicPos < rep0 ? dicBufSize : 0); >=20 >=20 >=20 > - processedPos +=3D curLen; >=20 > + processedPos +=3D (UInt32)curLen; >=20 >=20 >=20 > len -=3D curLen; >=20 > if (curLen <=3D dicBufSize - pos) >=20 > @@ -547,7 +547,7 @@ int MY_FAST_CALL LZMA_DECODE_REAL(CLzmaDec > *p, SizeT limit, const Byte *bufLimit > Byte *dest =3D dic + dicPos; >=20 > ptrdiff_t src =3D (ptrdiff_t)pos - (ptrdiff_t)dicPos; >=20 > const Byte *lim =3D dest + curLen; >=20 > - dicPos +=3D curLen; >=20 > + dicPos +=3D (SizeT)curLen; >=20 > do >=20 > *(dest) =3D (Byte)*(dest + src); >=20 > while (++dest !=3D lim); >=20 > @@ -572,14 +572,14 @@ int MY_FAST_CALL > LZMA_DECODE_REAL(CLzmaDec *p, SizeT limit, const Byte *bufLimit > p->buf =3D buf; >=20 > p->range =3D range; >=20 > p->code =3D code; >=20 > - p->remainLen =3D len; >=20 > + p->remainLen =3D (UInt32)len; >=20 > p->dicPos =3D dicPos; >=20 > p->processedPos =3D processedPos; >=20 > p->reps[0] =3D rep0; >=20 > p->reps[1] =3D rep1; >=20 > p->reps[2] =3D rep2; >=20 > p->reps[3] =3D rep3; >=20 > - p->state =3D state; >=20 > + p->state =3D (UInt32)state; >=20 >=20 >=20 > return SZ_OK; >=20 > } >=20 > @@ -601,8 +601,8 @@ static void MY_FAST_CALL > LzmaDec_WriteRem(CLzmaDec *p, SizeT limit) > if (p->checkDicSize =3D=3D 0 && p->prop.dicSize - p->processedPos = <=3D len) >=20 > p->checkDicSize =3D p->prop.dicSize; >=20 >=20 >=20 > - p->processedPos +=3D len; >=20 > - p->remainLen -=3D len; >=20 > + p->processedPos +=3D (UInt32)len; >=20 > + p->remainLen -=3D (UInt32)len; >=20 > while (len !=3D 0) >=20 > { >=20 > len--; >=20 > @@ -850,7 +850,7 @@ static ELzmaDummy LzmaDec_TryDummy(const > CLzmaDec *p, const Byte *buf, SizeT inS > } >=20 >=20 >=20 >=20 >=20 > -void LzmaDec_InitDicAndState(CLzmaDec *p, Bool initDic, Bool = initState) >=20 > +void LzmaDec_InitDicAndState(CLzmaDec *p, BoolInt initDic, BoolInt > initState) >=20 > { >=20 > p->remainLen =3D kMatchSpecLenStart + 1; >=20 > p->tempBufSize =3D 0; >=20 > @@ -979,10 +979,10 @@ SRes LzmaDec_DecodeToDic(CLzmaDec *p, SizeT > dicLimit, const Byte *src, SizeT *sr > p->tempBufSize =3D rem; >=20 > if (rem < LZMA_REQUIRED_INPUT_MAX || checkEndMarkNow) >=20 > { >=20 > - int dummyRes =3D LzmaDec_TryDummy(p, p->tempBuf, rem); >=20 > + int dummyRes =3D LzmaDec_TryDummy(p, p->tempBuf, > (SizeT)rem); >=20 > if (dummyRes =3D=3D DUMMY_ERROR) >=20 > { >=20 > - (*srcLen) +=3D lookAhead; >=20 > + (*srcLen) +=3D (SizeT)lookAhead; >=20 > *status =3D LZMA_STATUS_NEEDS_MORE_INPUT; >=20 > return SZ_OK; >=20 > } >=20 > @@ -1005,9 +1005,9 @@ SRes LzmaDec_DecodeToDic(CLzmaDec *p, SizeT > dicLimit, const Byte *src, SizeT *sr > return SZ_ERROR_FAIL; /* some internal error */ >=20 > lookAhead -=3D rem; >=20 > } >=20 > - (*srcLen) +=3D lookAhead; >=20 > + (*srcLen) +=3D (SizeT)lookAhead; >=20 > src +=3D lookAhead; >=20 > - inSize -=3D lookAhead; >=20 > + inSize -=3D (SizeT)lookAhead; >=20 > p->tempBufSize =3D 0; >=20 > } >=20 > } >=20 > diff --git a/BaseTools/Source/C/LzmaCompress/Sdk/C/LzmaEnc.c > b/BaseTools/Source/C/LzmaCompress/Sdk/C/LzmaEnc.c > index e281716fee..4e9b499f8d 100644 > --- a/BaseTools/Source/C/LzmaCompress/Sdk/C/LzmaEnc.c > +++ b/BaseTools/Source/C/LzmaCompress/Sdk/C/LzmaEnc.c > @@ -1,5 +1,5 @@ > /* LzmaEnc.c -- LZMA Encoder >=20 > -2018-04-29 : Igor Pavlov : Public domain */ >=20 > +2019-01-10: Igor Pavlov : Public domain */ >=20 >=20 >=20 > #include "Precomp.h" >=20 >=20 >=20 > @@ -38,6 +38,8 @@ static unsigned g_STAT_OFFSET =3D 0; > #define kNumBitPriceShiftBits 4 >=20 > #define kBitPrice (1 << kNumBitPriceShiftBits) >=20 >=20 >=20 > +#define REP_LEN_COUNT 64 >=20 > + >=20 > void LzmaEncProps_Init(CLzmaEncProps *p) >=20 > { >=20 > p->level =3D 5; >=20 > @@ -52,7 +54,7 @@ void LzmaEncProps_Normalize(CLzmaEncProps *p) > int level =3D p->level; >=20 > if (level < 0) level =3D 5; >=20 > p->level =3D level; >=20 > - >=20 > + >=20 > if (p->dictSize =3D=3D 0) p->dictSize =3D (level <=3D 5 ? (1 << = (level * 2 + 14)) : (level > <=3D 7 ? (1 << 25) : (1 << 26))); >=20 > if (p->dictSize > p->reduceSize) >=20 > { >=20 > @@ -74,7 +76,7 @@ void LzmaEncProps_Normalize(CLzmaEncProps *p) > if (p->btMode < 0) p->btMode =3D (p->algo =3D=3D 0 ? 0 : 1); >=20 > if (p->numHashBytes < 0) p->numHashBytes =3D 4; >=20 > if (p->mc =3D=3D 0) p->mc =3D (16 + (p->fb >> 1)) >> (p->btMode ? 0 = : 1); >=20 > - >=20 > + >=20 > if (p->numThreads < 0) >=20 > p->numThreads =3D >=20 > #ifndef _7ZIP_ST >=20 > @@ -124,7 +126,7 @@ static void LzmaEnc_FastPosInit(Byte *g_FastPos) > g_FastPos[0] =3D 0; >=20 > g_FastPos[1] =3D 1; >=20 > g_FastPos +=3D 2; >=20 > - >=20 > + >=20 > for (slot =3D 2; slot < kNumLogBits * 2; slot++) >=20 > { >=20 > size_t k =3D ((size_t)1 << ((slot >> 1) - 1)); >=20 > @@ -183,8 +185,11 @@ typedef struct > } COptimal; >=20 >=20 >=20 >=20 >=20 > -#define kNumOpts (1 << 12) >=20 > -#define kPackReserve (1 + kNumOpts * 2) >=20 > +// 18.06 >=20 > +#define kNumOpts (1 << 11) >=20 > +#define kPackReserve (kNumOpts * 8) >=20 > +// #define kNumOpts (1 << 12) >=20 > +// #define kPackReserve (1 + kNumOpts * 2) >=20 >=20 >=20 > #define kNumLenToPosStates 4 >=20 > #define kNumPosSlotBits 6 >=20 > @@ -236,10 +241,18 @@ typedef struct > typedef struct >=20 > { >=20 > unsigned tableSize; >=20 > - unsigned counters[LZMA_NUM_PB_STATES_MAX]; >=20 > UInt32 prices[LZMA_NUM_PB_STATES_MAX][kLenNumSymbolsTotal]; >=20 > + // UInt32 prices1[LZMA_NUM_PB_STATES_MAX][kLenNumLowSymbols * > 2]; >=20 > + // UInt32 prices2[kLenNumSymbolsTotal]; >=20 > } CLenPriceEnc; >=20 >=20 >=20 > +#define GET_PRICE_LEN(p, posState, len) \ >=20 > + ((p)->prices[posState][(size_t)(len) - LZMA_MATCH_LEN_MIN]) >=20 > + >=20 > +/* >=20 > +#define GET_PRICE_LEN(p, posState, len) \ >=20 > + ((p)->prices2[(size_t)(len) - 2] + ((p)->prices1[posState][((len) = - 2) & > (kLenNumLowSymbols * 2 - 1)] & (((len) - 2 - kLenNumLowSymbols * 2) >> 9))) >=20 > +*/ >=20 >=20 >=20 > typedef struct >=20 > { >=20 > @@ -273,7 +286,7 @@ typedef struct >=20 >=20 > CLzmaProb posSlotEncoder[kNumLenToPosStates][1 << > kNumPosSlotBits]; >=20 > CLzmaProb posEncoders[kNumFullDistances]; >=20 > - >=20 > + >=20 > CLenEnc lenProbs; >=20 > CLenEnc repLenProbs; >=20 >=20 >=20 > @@ -308,16 +321,18 @@ typedef struct > unsigned lc, lp, pb; >=20 > unsigned lclp; >=20 >=20 >=20 > - Bool fastMode; >=20 > - Bool writeEndMark; >=20 > - Bool finished; >=20 > - Bool multiThread; >=20 > - Bool needInit; >=20 > + BoolInt fastMode; >=20 > + BoolInt writeEndMark; >=20 > + BoolInt finished; >=20 > + BoolInt multiThread; >=20 > + BoolInt needInit; >=20 > + // BoolInt _maxMode; >=20 >=20 >=20 > UInt64 nowPos64; >=20 > - >=20 > + >=20 > unsigned matchPriceCount; >=20 > - unsigned alignPriceCount; >=20 > + // unsigned alignPriceCount; >=20 > + int repLenEncCounter; >=20 >=20 >=20 > unsigned distTableSize; >=20 >=20 >=20 > @@ -325,7 +340,7 @@ typedef struct > SRes result; >=20 >=20 >=20 > #ifndef _7ZIP_ST >=20 > - Bool mtMode; >=20 > + BoolInt mtMode; >=20 > // begin of CMatchFinderMt is used in LZ thread >=20 > CMatchFinderMt matchFinderMt; >=20 > // end of CMatchFinderMt is used in BT and HASH threads >=20 > @@ -336,7 +351,7 @@ typedef struct > #ifndef _7ZIP_ST >=20 > Byte pad[128]; >=20 > #endif >=20 > - >=20 > + >=20 > // LZ thread >=20 > CProbPrice ProbPrices[kBitModelTotal >> kNumMoveReducingBits]; >=20 >=20 >=20 > @@ -355,7 +370,7 @@ typedef struct > CLzmaProb isRep0Long[kNumStates][LZMA_NUM_PB_STATES_MAX]; >=20 > CLzmaProb posSlotEncoder[kNumLenToPosStates][1 << > kNumPosSlotBits]; >=20 > CLzmaProb posEncoders[kNumFullDistances]; >=20 > - >=20 > + >=20 > CLenEnc lenProbs; >=20 > CLenEnc repLenProbs; >=20 >=20 >=20 > @@ -383,9 +398,9 @@ void LzmaEnc_SaveState(CLzmaEncHandle pp) > { >=20 > CLzmaEnc *p =3D (CLzmaEnc *)pp; >=20 > CSaveState *dest =3D &p->saveState; >=20 > - >=20 > + >=20 > dest->state =3D p->state; >=20 > - >=20 > + >=20 > dest->lenProbs =3D p->lenProbs; >=20 > dest->repLenProbs =3D p->repLenProbs; >=20 >=20 >=20 > @@ -414,9 +429,9 @@ void LzmaEnc_RestoreState(CLzmaEncHandle pp) >=20 >=20 > dest->lenProbs =3D p->lenProbs; >=20 > dest->repLenProbs =3D p->repLenProbs; >=20 > - >=20 > + >=20 > COPY_ARR(dest, p, reps); >=20 > - >=20 > + >=20 > COPY_ARR(dest, p, posAlignEncoder); >=20 > COPY_ARR(dest, p, isRep); >=20 > COPY_ARR(dest, p, isRepG0); >=20 > @@ -458,6 +473,7 @@ SRes LzmaEnc_SetProps(CLzmaEncHandle pp, const > CLzmaEncProps *props2) > p->lp =3D props.lp; >=20 > p->pb =3D props.pb; >=20 > p->fastMode =3D (props.algo =3D=3D 0); >=20 > + // p->_maxMode =3D True; >=20 > p->matchFinderBase.btMode =3D (Byte)(props.btMode ? 1 : 0); >=20 > { >=20 > unsigned numHashBytes =3D 4; >=20 > @@ -618,9 +634,9 @@ static void RangeEnc_FlushData(CRangeEnc *p) >=20 >=20 > #ifdef _LZMA_ENC_USE_BRANCH >=20 >=20 >=20 > -#define RC_BIT(p, prob, symbol) { \ >=20 > +#define RC_BIT(p, prob, bit) { \ >=20 > RC_BIT_PRE(p, prob) \ >=20 > - if (symbol =3D=3D 0) { range =3D newBound; ttt +=3D (kBitModelTotal = - ttt) >> > kNumMoveBits; } \ >=20 > + if (bit =3D=3D 0) { range =3D newBound; ttt +=3D (kBitModelTotal - = ttt) >> > kNumMoveBits; } \ >=20 > else { (p)->low +=3D newBound; range -=3D newBound; ttt -=3D ttt >> > kNumMoveBits; } \ >=20 > *(prob) =3D (CLzmaProb)ttt; \ >=20 > RC_NORM(p) \ >=20 > @@ -628,15 +644,15 @@ static void RangeEnc_FlushData(CRangeEnc *p) >=20 >=20 > #else >=20 >=20 >=20 > -#define RC_BIT(p, prob, symbol) { \ >=20 > +#define RC_BIT(p, prob, bit) { \ >=20 > UInt32 mask; \ >=20 > RC_BIT_PRE(p, prob) \ >=20 > - mask =3D 0 - (UInt32)symbol; \ >=20 > + mask =3D 0 - (UInt32)bit; \ >=20 > range &=3D mask; \ >=20 > mask &=3D newBound; \ >=20 > range -=3D mask; \ >=20 > (p)->low +=3D mask; \ >=20 > - mask =3D (UInt32)symbol - 1; \ >=20 > + mask =3D (UInt32)bit - 1; \ >=20 > range +=3D newBound & mask; \ >=20 > mask &=3D (kBitModelTotal - ((1 << kNumMoveBits) - 1)); \ >=20 > mask +=3D ((1 << kNumMoveBits) - 1); \ >=20 > @@ -673,42 +689,42 @@ static void RangeEnc_EncodeBit_0(CRangeEnc *p, > CLzmaProb *prob) > p->range =3D range; >=20 > } >=20 >=20 >=20 > -static void LitEnc_Encode(CRangeEnc *p, CLzmaProb *probs, UInt32 = symbol) >=20 > +static void LitEnc_Encode(CRangeEnc *p, CLzmaProb *probs, UInt32 sym) >=20 > { >=20 > UInt32 range =3D p->range; >=20 > - symbol |=3D 0x100; >=20 > + sym |=3D 0x100; >=20 > do >=20 > { >=20 > UInt32 ttt, newBound; >=20 > - // RangeEnc_EncodeBit(p, probs + (symbol >> 8), (symbol >> 7) & = 1); >=20 > - CLzmaProb *prob =3D probs + (symbol >> 8); >=20 > - UInt32 bit =3D (symbol >> 7) & 1; >=20 > - symbol <<=3D 1; >=20 > + // RangeEnc_EncodeBit(p, probs + (sym >> 8), (sym >> 7) & 1); >=20 > + CLzmaProb *prob =3D probs + (sym >> 8); >=20 > + UInt32 bit =3D (sym >> 7) & 1; >=20 > + sym <<=3D 1; >=20 > RC_BIT(p, prob, bit); >=20 > } >=20 > - while (symbol < 0x10000); >=20 > + while (sym < 0x10000); >=20 > p->range =3D range; >=20 > } >=20 >=20 >=20 > -static void LitEnc_EncodeMatched(CRangeEnc *p, CLzmaProb *probs, = UInt32 > symbol, UInt32 matchByte) >=20 > +static void LitEnc_EncodeMatched(CRangeEnc *p, CLzmaProb *probs, > UInt32 sym, UInt32 matchByte) >=20 > { >=20 > UInt32 range =3D p->range; >=20 > UInt32 offs =3D 0x100; >=20 > - symbol |=3D 0x100; >=20 > + sym |=3D 0x100; >=20 > do >=20 > { >=20 > UInt32 ttt, newBound; >=20 > CLzmaProb *prob; >=20 > UInt32 bit; >=20 > matchByte <<=3D 1; >=20 > - // RangeEnc_EncodeBit(p, probs + (offs + (matchByte & offs) + = (symbol >> > 8)), (symbol >> 7) & 1); >=20 > - prob =3D probs + (offs + (matchByte & offs) + (symbol >> 8)); >=20 > - bit =3D (symbol >> 7) & 1; >=20 > - symbol <<=3D 1; >=20 > - offs &=3D ~(matchByte ^ symbol); >=20 > + // RangeEnc_EncodeBit(p, probs + (offs + (matchByte & offs) + = (sym >> > 8)), (sym >> 7) & 1); >=20 > + prob =3D probs + (offs + (matchByte & offs) + (sym >> 8)); >=20 > + bit =3D (sym >> 7) & 1; >=20 > + sym <<=3D 1; >=20 > + offs &=3D ~(matchByte ^ sym); >=20 > RC_BIT(p, prob, bit); >=20 > } >=20 > - while (symbol < 0x10000); >=20 > + while (sym < 0x10000); >=20 > p->range =3D range; >=20 > } >=20 >=20 >=20 > @@ -739,11 +755,11 @@ static void LzmaEnc_InitPriceTables(CProbPrice > *ProbPrices) > } >=20 >=20 >=20 >=20 >=20 > -#define GET_PRICE(prob, symbol) \ >=20 > - p->ProbPrices[((prob) ^ (unsigned)(((-(int)(symbol))) & = (kBitModelTotal - > 1))) >> kNumMoveReducingBits]; >=20 > +#define GET_PRICE(prob, bit) \ >=20 > + p->ProbPrices[((prob) ^ (unsigned)(((-(int)(bit))) & = (kBitModelTotal - 1))) >> > kNumMoveReducingBits]; >=20 >=20 >=20 > -#define GET_PRICEa(prob, symbol) \ >=20 > - ProbPrices[((prob) ^ (unsigned)((-((int)(symbol))) & = (kBitModelTotal - > 1))) >> kNumMoveReducingBits]; >=20 > +#define GET_PRICEa(prob, bit) \ >=20 > + ProbPrices[((prob) ^ (unsigned)((-((int)(bit))) & = (kBitModelTotal - 1))) >> > kNumMoveReducingBits]; >=20 >=20 >=20 > #define GET_PRICE_0(prob) p->ProbPrices[(prob) >> > kNumMoveReducingBits] >=20 > #define GET_PRICE_1(prob) p->ProbPrices[((prob) ^ (kBitModelTotal - = 1)) >> > kNumMoveReducingBits] >=20 > @@ -752,48 +768,48 @@ static void LzmaEnc_InitPriceTables(CProbPrice > *ProbPrices) > #define GET_PRICEa_1(prob) ProbPrices[((prob) ^ (kBitModelTotal - 1)) = >> > kNumMoveReducingBits] >=20 >=20 >=20 >=20 >=20 > -static UInt32 LitEnc_GetPrice(const CLzmaProb *probs, UInt32 symbol, const > CProbPrice *ProbPrices) >=20 > +static UInt32 LitEnc_GetPrice(const CLzmaProb *probs, UInt32 sym, = const > CProbPrice *ProbPrices) >=20 > { >=20 > UInt32 price =3D 0; >=20 > - symbol |=3D 0x100; >=20 > + sym |=3D 0x100; >=20 > do >=20 > { >=20 > - unsigned bit =3D symbol & 1; >=20 > - symbol >>=3D 1; >=20 > - price +=3D GET_PRICEa(probs[symbol], bit); >=20 > + unsigned bit =3D sym & 1; >=20 > + sym >>=3D 1; >=20 > + price +=3D GET_PRICEa(probs[sym], bit); >=20 > } >=20 > - while (symbol >=3D 2); >=20 > + while (sym >=3D 2); >=20 > return price; >=20 > } >=20 >=20 >=20 >=20 >=20 > -static UInt32 LitEnc_Matched_GetPrice(const CLzmaProb *probs, UInt32 > symbol, UInt32 matchByte, const CProbPrice *ProbPrices) >=20 > +static UInt32 LitEnc_Matched_GetPrice(const CLzmaProb *probs, UInt32 > sym, UInt32 matchByte, const CProbPrice *ProbPrices) >=20 > { >=20 > UInt32 price =3D 0; >=20 > UInt32 offs =3D 0x100; >=20 > - symbol |=3D 0x100; >=20 > + sym |=3D 0x100; >=20 > do >=20 > { >=20 > matchByte <<=3D 1; >=20 > - price +=3D GET_PRICEa(probs[offs + (matchByte & offs) + (symbol = >> 8)], > (symbol >> 7) & 1); >=20 > - symbol <<=3D 1; >=20 > - offs &=3D ~(matchByte ^ symbol); >=20 > + price +=3D GET_PRICEa(probs[offs + (matchByte & offs) + (sym >> = 8)], > (sym >> 7) & 1); >=20 > + sym <<=3D 1; >=20 > + offs &=3D ~(matchByte ^ sym); >=20 > } >=20 > - while (symbol < 0x10000); >=20 > + while (sym < 0x10000); >=20 > return price; >=20 > } >=20 >=20 >=20 >=20 >=20 > -static void RcTree_ReverseEncode(CRangeEnc *rc, CLzmaProb *probs, > unsigned numBits, UInt32 symbol) >=20 > +static void RcTree_ReverseEncode(CRangeEnc *rc, CLzmaProb *probs, > unsigned numBits, unsigned sym) >=20 > { >=20 > UInt32 range =3D rc->range; >=20 > unsigned m =3D 1; >=20 > do >=20 > { >=20 > UInt32 ttt, newBound; >=20 > - unsigned bit =3D symbol & 1; >=20 > + unsigned bit =3D sym & 1; >=20 > // RangeEnc_EncodeBit(rc, probs + m, bit); >=20 > - symbol >>=3D 1; >=20 > + sym >>=3D 1; >=20 > RC_BIT(rc, probs + m, bit); >=20 > m =3D (m << 1) | bit; >=20 > } >=20 > @@ -812,37 +828,37 @@ static void LenEnc_Init(CLenEnc *p) > p->high[i] =3D kProbInitValue; >=20 > } >=20 >=20 >=20 > -static void LenEnc_Encode(CLenEnc *p, CRangeEnc *rc, unsigned symbol, > unsigned posState) >=20 > +static void LenEnc_Encode(CLenEnc *p, CRangeEnc *rc, unsigned sym, > unsigned posState) >=20 > { >=20 > UInt32 range, ttt, newBound; >=20 > CLzmaProb *probs =3D p->low; >=20 > range =3D rc->range; >=20 > RC_BIT_PRE(rc, probs); >=20 > - if (symbol >=3D kLenNumLowSymbols) >=20 > + if (sym >=3D kLenNumLowSymbols) >=20 > { >=20 > RC_BIT_1(rc, probs); >=20 > probs +=3D kLenNumLowSymbols; >=20 > RC_BIT_PRE(rc, probs); >=20 > - if (symbol >=3D kLenNumLowSymbols * 2) >=20 > + if (sym >=3D kLenNumLowSymbols * 2) >=20 > { >=20 > RC_BIT_1(rc, probs); >=20 > rc->range =3D range; >=20 > - // RcTree_Encode(rc, p->high, kLenNumHighBits, symbol - > kLenNumLowSymbols * 2); >=20 > - LitEnc_Encode(rc, p->high, symbol - kLenNumLowSymbols * 2); >=20 > + // RcTree_Encode(rc, p->high, kLenNumHighBits, sym - > kLenNumLowSymbols * 2); >=20 > + LitEnc_Encode(rc, p->high, sym - kLenNumLowSymbols * 2); >=20 > return; >=20 > } >=20 > - symbol -=3D kLenNumLowSymbols; >=20 > + sym -=3D kLenNumLowSymbols; >=20 > } >=20 >=20 >=20 > - // RcTree_Encode(rc, probs + (posState << kLenNumLowBits), > kLenNumLowBits, symbol); >=20 > + // RcTree_Encode(rc, probs + (posState << kLenNumLowBits), > kLenNumLowBits, sym); >=20 > { >=20 > unsigned m; >=20 > unsigned bit; >=20 > RC_BIT_0(rc, probs); >=20 > probs +=3D (posState << (1 + kLenNumLowBits)); >=20 > - bit =3D (symbol >> 2) ; RC_BIT(rc, probs + 1, bit); m =3D (1 = << 1) + bit; >=20 > - bit =3D (symbol >> 1) & 1; RC_BIT(rc, probs + m, bit); m =3D (m = << 1) + bit; >=20 > - bit =3D symbol & 1; RC_BIT(rc, probs + m, bit); >=20 > + bit =3D (sym >> 2) ; RC_BIT(rc, probs + 1, bit); m =3D (1 << = 1) + bit; >=20 > + bit =3D (sym >> 1) & 1; RC_BIT(rc, probs + m, bit); m =3D (m << = 1) + bit; >=20 > + bit =3D sym & 1; RC_BIT(rc, probs + m, bit); >=20 > rc->range =3D range; >=20 > } >=20 > } >=20 > @@ -863,50 +879,93 @@ static void SetPrices_3(const CLzmaProb *probs, > UInt32 startPrice, UInt32 *price > } >=20 >=20 >=20 >=20 >=20 > -MY_NO_INLINE static void MY_FAST_CALL LenPriceEnc_UpdateTable( >=20 > - CLenPriceEnc *p, unsigned posState, >=20 > +MY_NO_INLINE static void MY_FAST_CALL LenPriceEnc_UpdateTables( >=20 > + CLenPriceEnc *p, >=20 > + unsigned numPosStates, >=20 > const CLenEnc *enc, >=20 > const CProbPrice *ProbPrices) >=20 > { >=20 > - // int y; for (y =3D 0; y < 100; y++) { >=20 > - UInt32 a; >=20 > - unsigned i, numSymbols; >=20 > + UInt32 b; >=20 > + >=20 > + { >=20 > + unsigned prob =3D enc->low[0]; >=20 > + UInt32 a, c; >=20 > + unsigned posState; >=20 > + b =3D GET_PRICEa_1(prob); >=20 > + a =3D GET_PRICEa_0(prob); >=20 > + c =3D b + GET_PRICEa_0(enc->low[kLenNumLowSymbols]); >=20 > + for (posState =3D 0; posState < numPosStates; posState++) >=20 > + { >=20 > + UInt32 *prices =3D p->prices[posState]; >=20 > + const CLzmaProb *probs =3D enc->low + (posState << (1 + > kLenNumLowBits)); >=20 > + SetPrices_3(probs, a, prices, ProbPrices); >=20 > + SetPrices_3(probs + kLenNumLowSymbols, c, prices + > kLenNumLowSymbols, ProbPrices); >=20 > + } >=20 > + } >=20 >=20 >=20 > - UInt32 *prices =3D p->prices[posState]; >=20 > + /* >=20 > { >=20 > - const CLzmaProb *probs =3D enc->low + (posState << (1 + > kLenNumLowBits)); >=20 > - SetPrices_3(probs, GET_PRICEa_0(enc->low[0]), prices, = ProbPrices); >=20 > + unsigned i; >=20 > + UInt32 b; >=20 > + a =3D GET_PRICEa_0(enc->low[0]); >=20 > + for (i =3D 0; i < kLenNumLowSymbols; i++) >=20 > + p->prices2[i] =3D a; >=20 > a =3D GET_PRICEa_1(enc->low[0]); >=20 > - SetPrices_3(probs + kLenNumLowSymbols, a + > GET_PRICEa_0(enc->low[kLenNumLowSymbols]), prices + > kLenNumLowSymbols, ProbPrices); >=20 > + b =3D a + GET_PRICEa_0(enc->low[kLenNumLowSymbols]); >=20 > + for (i =3D kLenNumLowSymbols; i < kLenNumLowSymbols * 2; i++) >=20 > + p->prices2[i] =3D b; >=20 > a +=3D GET_PRICEa_1(enc->low[kLenNumLowSymbols]); >=20 > } >=20 > - numSymbols =3D p->tableSize; >=20 > - p->counters[posState] =3D numSymbols; >=20 > - for (i =3D kLenNumLowSymbols * 2; i < numSymbols; i +=3D 1) >=20 > + */ >=20 > + >=20 > + // p->counter =3D numSymbols; >=20 > + // p->counter =3D 64; >=20 > + >=20 > { >=20 > - prices[i] =3D a + >=20 > - // RcTree_GetPrice(enc->high, kLenNumHighBits, i - > kLenNumLowSymbols * 2, ProbPrices); >=20 > - LitEnc_GetPrice(enc->high, i - kLenNumLowSymbols * 2, > ProbPrices); >=20 > - /* >=20 > - unsigned sym =3D (i - kLenNumLowSymbols * 2) >> 1; >=20 > - UInt32 price =3D a + RcTree_GetPrice(enc->high, kLenNumHighBits - = 1, > sym, ProbPrices); >=20 > - UInt32 prob =3D enc->high[(1 << 7) + sym]; >=20 > - prices[i ] =3D price + GET_PRICEa_0(prob); >=20 > - prices[i + 1] =3D price + GET_PRICEa_1(prob); >=20 > - */ >=20 > - } >=20 > - // } >=20 > -} >=20 > + unsigned i =3D p->tableSize; >=20 >=20 >=20 > -static void LenPriceEnc_UpdateTables(CLenPriceEnc *p, unsigned > numPosStates, >=20 > - const CLenEnc *enc, >=20 > - const CProbPrice *ProbPrices) >=20 > -{ >=20 > - unsigned posState; >=20 > - for (posState =3D 0; posState < numPosStates; posState++) >=20 > - LenPriceEnc_UpdateTable(p, posState, enc, ProbPrices); >=20 > -} >=20 > + if (i > kLenNumLowSymbols * 2) >=20 > + { >=20 > + const CLzmaProb *probs =3D enc->high; >=20 > + UInt32 *prices =3D p->prices[0] + kLenNumLowSymbols * 2; >=20 > + i -=3D kLenNumLowSymbols * 2 - 1; >=20 > + i >>=3D 1; >=20 > + b +=3D GET_PRICEa_1(enc->low[kLenNumLowSymbols]); >=20 > + do >=20 > + { >=20 > + /* >=20 > + p->prices2[i] =3D a + >=20 > + // RcTree_GetPrice(enc->high, kLenNumHighBits, i - > kLenNumLowSymbols * 2, ProbPrices); >=20 > + LitEnc_GetPrice(probs, i - kLenNumLowSymbols * 2, = ProbPrices); >=20 > + */ >=20 > + // UInt32 price =3D a + RcTree_GetPrice(probs, = kLenNumHighBits - 1, > sym, ProbPrices); >=20 > + unsigned sym =3D --i + (1 << (kLenNumHighBits - 1)); >=20 > + UInt32 price =3D b; >=20 > + do >=20 > + { >=20 > + unsigned bit =3D sym & 1; >=20 > + sym >>=3D 1; >=20 > + price +=3D GET_PRICEa(probs[sym], bit); >=20 > + } >=20 > + while (sym >=3D 2); >=20 > + >=20 > + { >=20 > + unsigned prob =3D probs[(size_t)i + (1 << (kLenNumHighBits = - 1))]; >=20 > + prices[(size_t)i * 2 ] =3D price + GET_PRICEa_0(prob); >=20 > + prices[(size_t)i * 2 + 1] =3D price + GET_PRICEa_1(prob); >=20 > + } >=20 > + } >=20 > + while (i); >=20 >=20 >=20 > + { >=20 > + unsigned posState; >=20 > + size_t num =3D (p->tableSize - kLenNumLowSymbols * 2) * > sizeof(p->prices[0][0]); >=20 > + for (posState =3D 1; posState < numPosStates; posState++) >=20 > + memcpy(p->prices[posState] + kLenNumLowSymbols * 2, > p->prices[0] + kLenNumLowSymbols * 2, num); >=20 > + } >=20 > + } >=20 > + } >=20 > +} >=20 >=20 >=20 > /* >=20 > #ifdef SHOW_STAT >=20 > @@ -914,21 +973,21 @@ static void > LenPriceEnc_UpdateTables(CLenPriceEnc *p, unsigned numPosStates, > printf("\n MovePos %u", num); >=20 > #endif >=20 > */ >=20 > - >=20 > + >=20 > #define MOVE_POS(p, num) { \ >=20 > p->additionalOffset +=3D (num); \ >=20 > - p->matchFinder.Skip(p->matchFinderObj, (num)); } >=20 > + p->matchFinder.Skip(p->matchFinderObj, (UInt32)(num)); } >=20 >=20 >=20 >=20 >=20 > static unsigned ReadMatchDistances(CLzmaEnc *p, unsigned = *numPairsRes) >=20 > { >=20 > unsigned numPairs; >=20 > - >=20 > + >=20 > p->additionalOffset++; >=20 > p->numAvail =3D > p->matchFinder.GetNumAvailableBytes(p->matchFinderObj); >=20 > numPairs =3D p->matchFinder.GetMatches(p->matchFinderObj, > p->matches); >=20 > *numPairsRes =3D numPairs; >=20 > - >=20 > + >=20 > #ifdef SHOW_STAT >=20 > printf("\n i =3D %u numPairs =3D %u ", g_STAT_OFFSET, numPairs / = 2); >=20 > g_STAT_OFFSET++; >=20 > @@ -938,7 +997,7 @@ static unsigned ReadMatchDistances(CLzmaEnc *p, > unsigned *numPairsRes) > printf("%2u %6u | ", p->matches[i], p->matches[i + 1]); >=20 > } >=20 > #endif >=20 > - >=20 > + >=20 > if (numPairs =3D=3D 0) >=20 > return 0; >=20 > { >=20 > @@ -954,7 +1013,8 @@ static unsigned ReadMatchDistances(CLzmaEnc *p, > unsigned *numPairsRes) > const Byte *p2 =3D p1 + len; >=20 > ptrdiff_t dif =3D (ptrdiff_t)-1 - p->matches[(size_t)numPairs = - 1]; >=20 > const Byte *lim =3D p1 + numAvail; >=20 > - for (; p2 !=3D lim && *p2 =3D=3D p2[dif]; p2++); >=20 > + for (; p2 !=3D lim && *p2 =3D=3D p2[dif]; p2++) >=20 > + {} >=20 > return (unsigned)(p2 - p1); >=20 > } >=20 > } >=20 > @@ -976,8 +1036,8 @@ static unsigned ReadMatchDistances(CLzmaEnc *p, > unsigned *numPairsRes) > + GET_PRICE_1(p->isRep0Long[state][posState])) \ >=20 > + GET_PRICE_1(p->isRep[state]) \ >=20 > + GET_PRICE_0(p->isRepG0[state]) >=20 > - >=20 >=20 >=20 > +MY_FORCE_INLINE >=20 > static UInt32 GetPrice_PureRep(const CLzmaEnc *p, unsigned repIndex, > size_t state, size_t posState) >=20 > { >=20 > UInt32 price; >=20 > @@ -1011,14 +1071,14 @@ static unsigned Backward(CLzmaEnc *p, > unsigned cur) > for (;;) >=20 > { >=20 > UInt32 dist =3D p->opt[cur].dist; >=20 > - UInt32 len =3D p->opt[cur].len; >=20 > - UInt32 extra =3D p->opt[cur].extra; >=20 > + unsigned len =3D (unsigned)p->opt[cur].len; >=20 > + unsigned extra =3D (unsigned)p->opt[cur].extra; >=20 > cur -=3D len; >=20 >=20 >=20 > if (extra) >=20 > { >=20 > wr--; >=20 > - p->opt[wr].len =3D len; >=20 > + p->opt[wr].len =3D (UInt32)len; >=20 > cur -=3D extra; >=20 > len =3D extra; >=20 > if (extra =3D=3D 1) >=20 > @@ -1042,10 +1102,10 @@ static unsigned Backward(CLzmaEnc *p, > unsigned cur) > p->optCur =3D wr; >=20 > return len; >=20 > } >=20 > - >=20 > + >=20 > wr--; >=20 > p->opt[wr].dist =3D dist; >=20 > - p->opt[wr].len =3D len; >=20 > + p->opt[wr].len =3D (UInt32)len; >=20 > } >=20 > } >=20 >=20 >=20 > @@ -1068,9 +1128,9 @@ static unsigned GetOptimum(CLzmaEnc *p, UInt32 > position) > UInt32 matchPrice, repMatchPrice; >=20 > const Byte *data; >=20 > Byte curByte, matchByte; >=20 > - >=20 > + >=20 > p->optCur =3D p->optEnd =3D 0; >=20 > - >=20 > + >=20 > if (p->additionalOffset =3D=3D 0) >=20 > mainLen =3D ReadMatchDistances(p, &numPairs); >=20 > else >=20 > @@ -1078,7 +1138,7 @@ static unsigned GetOptimum(CLzmaEnc *p, UInt32 > position) > mainLen =3D p->longestMatchLen; >=20 > numPairs =3D p->numPairs; >=20 > } >=20 > - >=20 > + >=20 > numAvail =3D p->numAvail; >=20 > if (numAvail < 2) >=20 > { >=20 > @@ -1087,10 +1147,10 @@ static unsigned GetOptimum(CLzmaEnc *p, > UInt32 position) > } >=20 > if (numAvail > LZMA_MATCH_LEN_MAX) >=20 > numAvail =3D LZMA_MATCH_LEN_MAX; >=20 > - >=20 > + >=20 > data =3D p->matchFinder.GetPointerToCurrentPos(p->matchFinderObj) = - 1; >=20 > repMaxIndex =3D 0; >=20 > - >=20 > + >=20 > for (i =3D 0; i < LZMA_NUM_REPS; i++) >=20 > { >=20 > unsigned len; >=20 > @@ -1102,43 +1162,48 @@ static unsigned GetOptimum(CLzmaEnc *p, > UInt32 position) > repLens[i] =3D 0; >=20 > continue; >=20 > } >=20 > - for (len =3D 2; len < numAvail && data[len] =3D=3D data2[len]; = len++); >=20 > + for (len =3D 2; len < numAvail && data[len] =3D=3D data2[len]; = len++) >=20 > + {} >=20 > repLens[i] =3D len; >=20 > if (len > repLens[repMaxIndex]) >=20 > repMaxIndex =3D i; >=20 > } >=20 > - >=20 > + >=20 > if (repLens[repMaxIndex] >=3D p->numFastBytes) >=20 > { >=20 > unsigned len; >=20 > - p->backRes =3D repMaxIndex; >=20 > + p->backRes =3D (UInt32)repMaxIndex; >=20 > len =3D repLens[repMaxIndex]; >=20 > MOVE_POS(p, len - 1) >=20 > return len; >=20 > } >=20 > - >=20 > + >=20 > matches =3D p->matches; >=20 > - >=20 > + >=20 > if (mainLen >=3D p->numFastBytes) >=20 > { >=20 > p->backRes =3D matches[(size_t)numPairs - 1] + LZMA_NUM_REPS; >=20 > MOVE_POS(p, mainLen - 1) >=20 > return mainLen; >=20 > } >=20 > - >=20 > + >=20 > curByte =3D *data; >=20 > matchByte =3D *(data - reps[0]); >=20 > - >=20 > - if (mainLen < 2 && curByte !=3D matchByte && repLens[repMaxIndex] = < > 2) >=20 > + >=20 > + last =3D repLens[repMaxIndex]; >=20 > + if (last <=3D mainLen) >=20 > + last =3D mainLen; >=20 > + >=20 > + if (last < 2 && curByte !=3D matchByte) >=20 > { >=20 > p->backRes =3D MARK_LIT; >=20 > return 1; >=20 > } >=20 > - >=20 > + >=20 > p->opt[0].state =3D (CState)p->state; >=20 > - >=20 > + >=20 > posState =3D (position & p->pbMask); >=20 > - >=20 > + >=20 > { >=20 > const CLzmaProb *probs =3D LIT_PROBS(position, *(data - 1)); >=20 > p->opt[1].price =3D GET_PRICE_0(p->isMatch[p->state][posState]) = + >=20 > @@ -1146,13 +1211,14 @@ static unsigned GetOptimum(CLzmaEnc *p, > UInt32 position) > LitEnc_Matched_GetPrice(probs, curByte, matchByte, > p->ProbPrices) : >=20 > LitEnc_GetPrice(probs, curByte, p->ProbPrices)); >=20 > } >=20 > - >=20 > + >=20 > MakeAs_Lit(&p->opt[1]); >=20 > - >=20 > + >=20 > matchPrice =3D GET_PRICE_1(p->isMatch[p->state][posState]); >=20 > repMatchPrice =3D matchPrice + GET_PRICE_1(p->isRep[p->state]); >=20 > - >=20 > - if (matchByte =3D=3D curByte) >=20 > + >=20 > + // 18.06 >=20 > + if (matchByte =3D=3D curByte && repLens[0] =3D=3D 0) >=20 > { >=20 > UInt32 shortRepPrice =3D repMatchPrice + GetPrice_ShortRep(p, > p->state, posState); >=20 > if (shortRepPrice < p->opt[1].price) >=20 > @@ -1160,32 +1226,22 @@ static unsigned GetOptimum(CLzmaEnc *p, > UInt32 position) > p->opt[1].price =3D shortRepPrice; >=20 > MakeAs_ShortRep(&p->opt[1]); >=20 > } >=20 > + if (last < 2) >=20 > + { >=20 > + p->backRes =3D p->opt[1].dist; >=20 > + return 1; >=20 > + } >=20 > } >=20 > - >=20 > - last =3D (mainLen >=3D repLens[repMaxIndex] ? mainLen : > repLens[repMaxIndex]); >=20 > - >=20 > - if (last < 2) >=20 > - { >=20 > - p->backRes =3D p->opt[1].dist; >=20 > - return 1; >=20 > - } >=20 > - >=20 > + >=20 > p->opt[1].len =3D 1; >=20 > - >=20 > + >=20 > p->opt[0].reps[0] =3D reps[0]; >=20 > p->opt[0].reps[1] =3D reps[1]; >=20 > p->opt[0].reps[2] =3D reps[2]; >=20 > p->opt[0].reps[3] =3D reps[3]; >=20 > - >=20 > - { >=20 > - unsigned len =3D last; >=20 > - do >=20 > - p->opt[len--].price =3D kInfinityPrice; >=20 > - while (len >=3D 2); >=20 > - } >=20 >=20 >=20 > // ---------- REP ---------- >=20 > - >=20 > + >=20 > for (i =3D 0; i < LZMA_NUM_REPS; i++) >=20 > { >=20 > unsigned repLen =3D repLens[i]; >=20 > @@ -1195,58 +1251,61 @@ static unsigned GetOptimum(CLzmaEnc *p, > UInt32 position) > price =3D repMatchPrice + GetPrice_PureRep(p, i, p->state, = posState); >=20 > do >=20 > { >=20 > - UInt32 price2 =3D price + > p->repLenEnc.prices[posState][(size_t)repLen - 2]; >=20 > + UInt32 price2 =3D price + GET_PRICE_LEN(&p->repLenEnc, = posState, > repLen); >=20 > COptimal *opt =3D &p->opt[repLen]; >=20 > if (price2 < opt->price) >=20 > { >=20 > opt->price =3D price2; >=20 > - opt->len =3D repLen; >=20 > - opt->dist =3D i; >=20 > + opt->len =3D (UInt32)repLen; >=20 > + opt->dist =3D (UInt32)i; >=20 > opt->extra =3D 0; >=20 > } >=20 > } >=20 > while (--repLen >=3D 2); >=20 > } >=20 > - >=20 > - >=20 > + >=20 > + >=20 > // ---------- MATCH ---------- >=20 > { >=20 > - unsigned len =3D ((repLens[0] >=3D 2) ? repLens[0] + 1 : 2); >=20 > + unsigned len =3D repLens[0] + 1; >=20 > if (len <=3D mainLen) >=20 > { >=20 > unsigned offs =3D 0; >=20 > UInt32 normalMatchPrice =3D matchPrice + > GET_PRICE_0(p->isRep[p->state]); >=20 >=20 >=20 > - while (len > matches[offs]) >=20 > - offs +=3D 2; >=20 > - >=20 > + if (len < 2) >=20 > + len =3D 2; >=20 > + else >=20 > + while (len > matches[offs]) >=20 > + offs +=3D 2; >=20 > + >=20 > for (; ; len++) >=20 > { >=20 > COptimal *opt; >=20 > UInt32 dist =3D matches[(size_t)offs + 1]; >=20 > - UInt32 price2 =3D normalMatchPrice + > p->lenEnc.prices[posState][(size_t)len - LZMA_MATCH_LEN_MIN]; >=20 > + UInt32 price =3D normalMatchPrice + > GET_PRICE_LEN(&p->lenEnc, posState, len); >=20 > unsigned lenToPosState =3D GetLenToPosState(len); >=20 > - >=20 > + >=20 > if (dist < kNumFullDistances) >=20 > - price2 +=3D p->distancesPrices[lenToPosState][dist & > (kNumFullDistances - 1)]; >=20 > + price +=3D p->distancesPrices[lenToPosState][dist & > (kNumFullDistances - 1)]; >=20 > else >=20 > { >=20 > unsigned slot; >=20 > GetPosSlot2(dist, slot); >=20 > - price2 +=3D p->alignPrices[dist & kAlignMask]; >=20 > - price2 +=3D p->posSlotPrices[lenToPosState][slot]; >=20 > + price +=3D p->alignPrices[dist & kAlignMask]; >=20 > + price +=3D p->posSlotPrices[lenToPosState][slot]; >=20 > } >=20 > - >=20 > + >=20 > opt =3D &p->opt[len]; >=20 > - >=20 > - if (price2 < opt->price) >=20 > + >=20 > + if (price < opt->price) >=20 > { >=20 > - opt->price =3D price2; >=20 > - opt->len =3D len; >=20 > + opt->price =3D price; >=20 > + opt->len =3D (UInt32)len; >=20 > opt->dist =3D dist + LZMA_NUM_REPS; >=20 > opt->extra =3D 0; >=20 > } >=20 > - >=20 > + >=20 > if (len =3D=3D matches[offs]) >=20 > { >=20 > offs +=3D 2; >=20 > @@ -1256,7 +1315,7 @@ static unsigned GetOptimum(CLzmaEnc *p, UInt32 > position) > } >=20 > } >=20 > } >=20 > - >=20 > + >=20 >=20 >=20 > cur =3D 0; >=20 >=20 >=20 > @@ -1272,37 +1331,73 @@ static unsigned GetOptimum(CLzmaEnc *p, > UInt32 position) > } >=20 >=20 >=20 >=20 >=20 > - >=20 > + >=20 > // ---------- Optimal Parsing ---------- >=20 >=20 >=20 > for (;;) >=20 > { >=20 > - UInt32 numAvail, numAvailFull; >=20 > + unsigned numAvail; >=20 > + UInt32 numAvailFull; >=20 > unsigned newLen, numPairs, prev, state, posState, startLen; >=20 > - UInt32 curPrice, litPrice, matchPrice, repMatchPrice; >=20 > - Bool nextIsLit; >=20 > + UInt32 litPrice, matchPrice, repMatchPrice; >=20 > + BoolInt nextIsLit; >=20 > Byte curByte, matchByte; >=20 > const Byte *data; >=20 > COptimal *curOpt, *nextOpt; >=20 >=20 >=20 > if (++cur =3D=3D last) >=20 > - return Backward(p, cur); >=20 > + break; >=20 > + >=20 > + // 18.06 >=20 > + if (cur >=3D kNumOpts - 64) >=20 > + { >=20 > + unsigned j, best; >=20 > + UInt32 price =3D p->opt[cur].price; >=20 > + best =3D cur; >=20 > + for (j =3D cur + 1; j <=3D last; j++) >=20 > + { >=20 > + UInt32 price2 =3D p->opt[j].price; >=20 > + if (price >=3D price2) >=20 > + { >=20 > + price =3D price2; >=20 > + best =3D j; >=20 > + } >=20 > + } >=20 > + { >=20 > + unsigned delta =3D best - cur; >=20 > + if (delta !=3D 0) >=20 > + { >=20 > + MOVE_POS(p, delta); >=20 > + } >=20 > + } >=20 > + cur =3D best; >=20 > + break; >=20 > + } >=20 >=20 >=20 > newLen =3D ReadMatchDistances(p, &numPairs); >=20 > - >=20 > + >=20 > if (newLen >=3D p->numFastBytes) >=20 > { >=20 > p->numPairs =3D numPairs; >=20 > p->longestMatchLen =3D newLen; >=20 > - return Backward(p, cur); >=20 > + break; >=20 > } >=20 > - >=20 > + >=20 > curOpt =3D &p->opt[cur]; >=20 > + >=20 > + position++; >=20 > + >=20 > + // we need that check here, if skip_items in p->opt are possible >=20 > + /* >=20 > + if (curOpt->price >=3D kInfinityPrice) >=20 > + continue; >=20 > + */ >=20 > + >=20 > prev =3D cur - curOpt->len; >=20 > - >=20 > + >=20 > if (curOpt->len =3D=3D 1) >=20 > { >=20 > - state =3D p->opt[prev].state; >=20 > + state =3D (unsigned)p->opt[prev].state; >=20 > if (IsShortRep(curOpt)) >=20 > state =3D kShortRepNextStates[state]; >=20 > else >=20 > @@ -1316,14 +1411,14 @@ static unsigned GetOptimum(CLzmaEnc *p, > UInt32 position) >=20 >=20 > if (curOpt->extra) >=20 > { >=20 > - prev -=3D curOpt->extra; >=20 > + prev -=3D (unsigned)curOpt->extra; >=20 > state =3D kState_RepAfterLit; >=20 > if (curOpt->extra =3D=3D 1) >=20 > - state =3D (dist < LZMA_NUM_REPS) ? kState_RepAfterLit : > kState_MatchAfterLit; >=20 > + state =3D (dist < LZMA_NUM_REPS ? kState_RepAfterLit : > kState_MatchAfterLit); >=20 > } >=20 > else >=20 > { >=20 > - state =3D p->opt[prev].state; >=20 > + state =3D (unsigned)p->opt[prev].state; >=20 > if (dist < LZMA_NUM_REPS) >=20 > state =3D kRepNextStates[state]; >=20 > else >=20 > @@ -1368,7 +1463,7 @@ static unsigned GetOptimum(CLzmaEnc *p, UInt32 > position) > reps[3] =3D prevOpt->reps[2]; >=20 > } >=20 > } >=20 > - >=20 > + >=20 > curOpt->state =3D (CState)state; >=20 > curOpt->reps[0] =3D reps[0]; >=20 > curOpt->reps[1] =3D reps[1]; >=20 > @@ -1379,7 +1474,6 @@ static unsigned GetOptimum(CLzmaEnc *p, UInt32 > position) > curByte =3D *data; >=20 > matchByte =3D *(data - reps[0]); >=20 >=20 >=20 > - position++; >=20 > posState =3D (position & p->pbMask); >=20 >=20 >=20 > /* >=20 > @@ -1391,19 +1485,31 @@ static unsigned GetOptimum(CLzmaEnc *p, > UInt32 position) > < MATCH [ : LIT : REP_0 ] >=20 > */ >=20 >=20 >=20 > - curPrice =3D curOpt->price; >=20 > - litPrice =3D curPrice + GET_PRICE_0(p->isMatch[state][posState]); >=20 > + { >=20 > + UInt32 curPrice =3D curOpt->price; >=20 > + unsigned prob =3D p->isMatch[state][posState]; >=20 > + matchPrice =3D curPrice + GET_PRICE_1(prob); >=20 > + litPrice =3D curPrice + GET_PRICE_0(prob); >=20 > + } >=20 >=20 >=20 > nextOpt =3D &p->opt[(size_t)cur + 1]; >=20 > nextIsLit =3D False; >=20 >=20 >=20 > - // if (litPrice >=3D nextOpt->price) litPrice =3D 0; else // = 18.new >=20 > + // here we can allow skip_items in p->opt, if we don't check > (nextOpt->price < kInfinityPrice) >=20 > + // 18.new.06 >=20 > + if ((nextOpt->price < kInfinityPrice >=20 > + // && !IsLitState(state) >=20 > + && matchByte =3D=3D curByte) >=20 > + || litPrice > nextOpt->price >=20 > + ) >=20 > + litPrice =3D 0; >=20 > + else >=20 > { >=20 > const CLzmaProb *probs =3D LIT_PROBS(position, *(data - 1)); >=20 > litPrice +=3D (!IsLitState(state) ? >=20 > LitEnc_Matched_GetPrice(probs, curByte, matchByte, > p->ProbPrices) : >=20 > LitEnc_GetPrice(probs, curByte, p->ProbPrices)); >=20 > - >=20 > + >=20 > if (litPrice < nextOpt->price) >=20 > { >=20 > nextOpt->price =3D litPrice; >=20 > @@ -1413,21 +1519,32 @@ static unsigned GetOptimum(CLzmaEnc *p, > UInt32 position) > } >=20 > } >=20 >=20 >=20 > - matchPrice =3D curPrice + = GET_PRICE_1(p->isMatch[state][posState]); >=20 > repMatchPrice =3D matchPrice + GET_PRICE_1(p->isRep[state]); >=20 > - >=20 > + >=20 > + numAvailFull =3D p->numAvail; >=20 > + { >=20 > + unsigned temp =3D kNumOpts - 1 - cur; >=20 > + if (numAvailFull > temp) >=20 > + numAvailFull =3D (UInt32)temp; >=20 > + } >=20 > + >=20 > + // 18.06 >=20 > // ---------- SHORT_REP ---------- >=20 > - // if (IsLitState(state)) // 18.new >=20 > + if (IsLitState(state)) // 18.new >=20 > if (matchByte =3D=3D curByte) >=20 > - // if (repMatchPrice < nextOpt->price) // 18.new >=20 > - if (nextOpt->len < 2 >=20 > + if (repMatchPrice < nextOpt->price) // 18.new >=20 > + // if (numAvailFull < 2 || data[1] !=3D *(data - reps[0] + 1)) >=20 > + if ( >=20 > + // nextOpt->price >=3D kInfinityPrice || >=20 > + nextOpt->len < 2 // we can check nextOpt->len, if skip = items > are not allowed in p->opt >=20 > || (nextOpt->dist !=3D 0 >=20 > - && nextOpt->extra <=3D 1 // 17.old >=20 > - )) >=20 > + // && nextOpt->extra <=3D 1 // 17.old >=20 > + ) >=20 > + ) >=20 > { >=20 > UInt32 shortRepPrice =3D repMatchPrice + GetPrice_ShortRep(p, = state, > posState); >=20 > - if (shortRepPrice <=3D nextOpt->price) // 17.old >=20 > - // if (shortRepPrice < nextOpt->price) // 18.new >=20 > + // if (shortRepPrice <=3D nextOpt->price) // 17.old >=20 > + if (shortRepPrice < nextOpt->price) // 18.new >=20 > { >=20 > nextOpt->price =3D shortRepPrice; >=20 > nextOpt->len =3D 1; >=20 > @@ -1435,13 +1552,6 @@ static unsigned GetOptimum(CLzmaEnc *p, > UInt32 position) > nextIsLit =3D False; >=20 > } >=20 > } >=20 > - >=20 > - numAvailFull =3D p->numAvail; >=20 > - { >=20 > - UInt32 temp =3D kNumOpts - 1 - cur; >=20 > - if (numAvailFull > temp) >=20 > - numAvailFull =3D temp; >=20 > - } >=20 >=20 >=20 > if (numAvailFull < 2) >=20 > continue; >=20 > @@ -1451,9 +1561,8 @@ static unsigned GetOptimum(CLzmaEnc *p, UInt32 > position) >=20 >=20 > // ---------- LIT : REP_0 ---------- >=20 >=20 >=20 > - if ( >=20 > - // litPrice !=3D 0 && // 18.new >=20 > - !nextIsLit >=20 > + if (!nextIsLit >=20 > + && litPrice !=3D 0 // 18.new >=20 > && matchByte !=3D curByte >=20 > && numAvailFull > 2) >=20 > { >=20 > @@ -1465,32 +1574,32 @@ static unsigned GetOptimum(CLzmaEnc *p, > UInt32 position) > if (limit > numAvailFull) >=20 > limit =3D numAvailFull; >=20 > for (len =3D 3; len < limit && data[len] =3D=3D data2[len]; = len++) >=20 > - { >=20 > - } >=20 > - >=20 > + {} >=20 > + >=20 > { >=20 > unsigned state2 =3D kLiteralNextStates[state]; >=20 > unsigned posState2 =3D (position + 1) & p->pbMask; >=20 > UInt32 price =3D litPrice + GetPrice_Rep_0(p, state2, = posState2); >=20 > { >=20 > unsigned offset =3D cur + len; >=20 > - while (last < offset) >=20 > - p->opt[++last].price =3D kInfinityPrice; >=20 > - >=20 > + >=20 > + if (last < offset) >=20 > + last =3D offset; >=20 > + >=20 > // do >=20 > { >=20 > UInt32 price2; >=20 > COptimal *opt; >=20 > len--; >=20 > // price2 =3D price + GetPrice_Len_Rep_0(p, len, = state2, > posState2); >=20 > - price2 =3D price + p->repLenEnc.prices[posState2][len - > LZMA_MATCH_LEN_MIN]; >=20 > + price2 =3D price + GET_PRICE_LEN(&p->repLenEnc, > posState2, len); >=20 >=20 >=20 > opt =3D &p->opt[offset]; >=20 > // offset--; >=20 > if (price2 < opt->price) >=20 > { >=20 > opt->price =3D price2; >=20 > - opt->len =3D len; >=20 > + opt->len =3D (UInt32)len; >=20 > opt->dist =3D 0; >=20 > opt->extra =3D 1; >=20 > } >=20 > @@ -1500,8 +1609,9 @@ static unsigned GetOptimum(CLzmaEnc *p, UInt32 > position) > } >=20 > } >=20 > } >=20 > - >=20 > + >=20 > startLen =3D 2; /* speed optimization */ >=20 > + >=20 > { >=20 > // ---------- REP ---------- >=20 > unsigned repIndex =3D 0; // 17.old >=20 > @@ -1513,31 +1623,35 @@ static unsigned GetOptimum(CLzmaEnc *p, > UInt32 position) > const Byte *data2 =3D data - reps[repIndex]; >=20 > if (data[0] !=3D data2[0] || data[1] !=3D data2[1]) >=20 > continue; >=20 > - >=20 > - for (len =3D 2; len < numAvail && data[len] =3D=3D = data2[len]; len++); >=20 > - >=20 > + >=20 > + for (len =3D 2; len < numAvail && data[len] =3D=3D = data2[len]; len++) >=20 > + {} >=20 > + >=20 > // if (len < startLen) continue; // 18.new: speed = optimization >=20 >=20 >=20 > - while (last < cur + len) >=20 > - p->opt[++last].price =3D kInfinityPrice; >=20 > + { >=20 > + unsigned offset =3D cur + len; >=20 > + if (last < offset) >=20 > + last =3D offset; >=20 > + } >=20 > { >=20 > unsigned len2 =3D len; >=20 > price =3D repMatchPrice + GetPrice_PureRep(p, repIndex, = state, > posState); >=20 > do >=20 > { >=20 > - UInt32 price2 =3D price + > p->repLenEnc.prices[posState][(size_t)len2 - 2]; >=20 > + UInt32 price2 =3D price + GET_PRICE_LEN(&p->repLenEnc, > posState, len2); >=20 > COptimal *opt =3D &p->opt[cur + len2]; >=20 > if (price2 < opt->price) >=20 > { >=20 > opt->price =3D price2; >=20 > - opt->len =3D len2; >=20 > - opt->dist =3D repIndex; >=20 > + opt->len =3D (UInt32)len2; >=20 > + opt->dist =3D (UInt32)repIndex; >=20 > opt->extra =3D 0; >=20 > } >=20 > } >=20 > while (--len2 >=3D 2); >=20 > } >=20 > - >=20 > + >=20 > if (repIndex =3D=3D 0) startLen =3D len + 1; // 17.old >=20 > // startLen =3D len + 1; // 18.new >=20 >=20 >=20 > @@ -1550,51 +1664,59 @@ static unsigned GetOptimum(CLzmaEnc *p, > UInt32 position) > unsigned limit =3D len2 + p->numFastBytes; >=20 > if (limit > numAvailFull) >=20 > limit =3D numAvailFull; >=20 > - >=20 > - for (; len2 < limit && data[len2] =3D=3D data2[len2]; = len2++); >=20 > - >=20 > - len2 -=3D len; >=20 > - if (len2 >=3D 3) >=20 > + >=20 > + len2 +=3D 2; >=20 > + if (len2 <=3D limit) >=20 > + if (data[len2 - 2] =3D=3D data2[len2 - 2]) >=20 > + if (data[len2 - 1] =3D=3D data2[len2 - 1]) >=20 > { >=20 > unsigned state2 =3D kRepNextStates[state]; >=20 > unsigned posState2 =3D (position + len) & p->pbMask; >=20 > - price +=3D >=20 > - p->repLenEnc.prices[posState][(size_t)len - 2] >=20 > + price +=3D GET_PRICE_LEN(&p->repLenEnc, posState, len) >=20 > + GET_PRICE_0(p->isMatch[state2][posState2]) >=20 > + LitEnc_Matched_GetPrice(LIT_PROBS(position + len, > data[(size_t)len - 1]), >=20 > data[len], data2[len], p->ProbPrices); >=20 > - >=20 > + >=20 > // state2 =3D kLiteralNextStates[state2]; >=20 > state2 =3D kState_LitAfterRep; >=20 > posState2 =3D (posState2 + 1) & p->pbMask; >=20 >=20 >=20 >=20 >=20 > price +=3D GetPrice_Rep_0(p, state2, posState2); >=20 > + >=20 > + for (; len2 < limit && data[len2] =3D=3D data2[len2]; = len2++) >=20 > + {} >=20 > + >=20 > + len2 -=3D len; >=20 > + // if (len2 >=3D 3) >=20 > + { >=20 > { >=20 > unsigned offset =3D cur + len + len2; >=20 > - while (last < offset) >=20 > - p->opt[++last].price =3D kInfinityPrice; >=20 > + >=20 > + if (last < offset) >=20 > + last =3D offset; >=20 > // do >=20 > { >=20 > - unsigned price2; >=20 > + UInt32 price2; >=20 > COptimal *opt; >=20 > len2--; >=20 > // price2 =3D price + GetPrice_Len_Rep_0(p, len2, = state2, > posState2); >=20 > - price2 =3D price + = p->repLenEnc.prices[posState2][len2 - > LZMA_MATCH_LEN_MIN]; >=20 > + price2 =3D price + GET_PRICE_LEN(&p->repLenEnc, > posState2, len2); >=20 >=20 >=20 > opt =3D &p->opt[offset]; >=20 > // offset--; >=20 > if (price2 < opt->price) >=20 > { >=20 > opt->price =3D price2; >=20 > - opt->len =3D len2; >=20 > + opt->len =3D (UInt32)len2; >=20 > opt->extra =3D (CExtra)(len + 1); >=20 > - opt->dist =3D repIndex; >=20 > + opt->dist =3D (UInt32)repIndex; >=20 > } >=20 > } >=20 > // while (len2 >=3D 3); >=20 > } >=20 > } >=20 > + } >=20 > } >=20 > } >=20 > } >=20 > @@ -1606,49 +1728,57 @@ static unsigned GetOptimum(CLzmaEnc *p, > UInt32 position) > { >=20 > newLen =3D numAvail; >=20 > for (numPairs =3D 0; newLen > matches[numPairs]; numPairs +=3D = 2); >=20 > - matches[numPairs] =3D newLen; >=20 > + matches[numPairs] =3D (UInt32)newLen; >=20 > numPairs +=3D 2; >=20 > } >=20 > - >=20 > + >=20 > + // startLen =3D 2; /* speed optimization */ >=20 > + >=20 > if (newLen >=3D startLen) >=20 > { >=20 > UInt32 normalMatchPrice =3D matchPrice + > GET_PRICE_0(p->isRep[state]); >=20 > UInt32 dist; >=20 > unsigned offs, posSlot, len; >=20 > - while (last < cur + newLen) >=20 > - p->opt[++last].price =3D kInfinityPrice; >=20 > + >=20 > + { >=20 > + unsigned offset =3D cur + newLen; >=20 > + if (last < offset) >=20 > + last =3D offset; >=20 > + } >=20 >=20 >=20 > offs =3D 0; >=20 > while (startLen > matches[offs]) >=20 > offs +=3D 2; >=20 > dist =3D matches[(size_t)offs + 1]; >=20 > - >=20 > + >=20 > // if (dist >=3D kNumFullDistances) >=20 > GetPosSlot2(dist, posSlot); >=20 > - >=20 > + >=20 > for (len =3D /*2*/ startLen; ; len++) >=20 > { >=20 > - UInt32 price =3D normalMatchPrice + > p->lenEnc.prices[posState][(size_t)len - LZMA_MATCH_LEN_MIN]; >=20 > + UInt32 price =3D normalMatchPrice + GET_PRICE_LEN(&p->lenEnc, > posState, len); >=20 > { >=20 > COptimal *opt; >=20 > - unsigned lenToPosState =3D len - 2; lenToPosState =3D > GetLenToPosState2(lenToPosState); >=20 > + unsigned lenNorm =3D len - 2; >=20 > + lenNorm =3D GetLenToPosState2(lenNorm); >=20 > if (dist < kNumFullDistances) >=20 > - price +=3D p->distancesPrices[lenToPosState][dist & > (kNumFullDistances - 1)]; >=20 > + price +=3D p->distancesPrices[lenNorm][dist & > (kNumFullDistances - 1)]; >=20 > else >=20 > - price +=3D p->posSlotPrices[lenToPosState][posSlot] + > p->alignPrices[dist & kAlignMask]; >=20 > - >=20 > + price +=3D p->posSlotPrices[lenNorm][posSlot] + > p->alignPrices[dist & kAlignMask]; >=20 > + >=20 > opt =3D &p->opt[cur + len]; >=20 > if (price < opt->price) >=20 > { >=20 > opt->price =3D price; >=20 > - opt->len =3D len; >=20 > + opt->len =3D (UInt32)len; >=20 > opt->dist =3D dist + LZMA_NUM_REPS; >=20 > opt->extra =3D 0; >=20 > } >=20 > } >=20 >=20 >=20 > - if (/*_maxMode && */ len =3D=3D matches[offs]) >=20 > + if (len =3D=3D matches[offs]) >=20 > { >=20 > + // if (p->_maxMode) { >=20 > // MATCH : LIT : REP_0 >=20 >=20 >=20 > const Byte *data2 =3D data - dist - 1; >=20 > @@ -1656,12 +1786,18 @@ static unsigned GetOptimum(CLzmaEnc *p, > UInt32 position) > unsigned limit =3D len2 + p->numFastBytes; >=20 > if (limit > numAvailFull) >=20 > limit =3D numAvailFull; >=20 > - >=20 > - for (; len2 < limit && data[len2] =3D=3D data2[len2]; = len2++); >=20 > - >=20 > + >=20 > + len2 +=3D 2; >=20 > + if (len2 <=3D limit) >=20 > + if (data[len2 - 2] =3D=3D data2[len2 - 2]) >=20 > + if (data[len2 - 1] =3D=3D data2[len2 - 1]) >=20 > + { >=20 > + for (; len2 < limit && data[len2] =3D=3D data2[len2]; = len2++) >=20 > + {} >=20 > + >=20 > len2 -=3D len; >=20 > - >=20 > - if (len2 >=3D 3) >=20 > + >=20 > + // if (len2 >=3D 3) >=20 > { >=20 > unsigned state2 =3D kMatchNextStates[state]; >=20 > unsigned posState2 =3D (position + len) & p->pbMask; >=20 > @@ -1677,28 +1813,31 @@ static unsigned GetOptimum(CLzmaEnc *p, > UInt32 position) > price +=3D GetPrice_Rep_0(p, state2, posState2); >=20 >=20 >=20 > offset =3D cur + len + len2; >=20 > - while (last < offset) >=20 > - p->opt[++last].price =3D kInfinityPrice; >=20 > + >=20 > + if (last < offset) >=20 > + last =3D offset; >=20 > // do >=20 > { >=20 > UInt32 price2; >=20 > COptimal *opt; >=20 > len2--; >=20 > // price2 =3D price + GetPrice_Len_Rep_0(p, len2, = state2, > posState2); >=20 > - price2 =3D price + p->repLenEnc.prices[posState2][len2 = - > LZMA_MATCH_LEN_MIN]; >=20 > + price2 =3D price + GET_PRICE_LEN(&p->repLenEnc, > posState2, len2); >=20 > opt =3D &p->opt[offset]; >=20 > // offset--; >=20 > if (price2 < opt->price) >=20 > { >=20 > opt->price =3D price2; >=20 > - opt->len =3D len2; >=20 > + opt->len =3D (UInt32)len2; >=20 > opt->extra =3D (CExtra)(len + 1); >=20 > opt->dist =3D dist + LZMA_NUM_REPS; >=20 > } >=20 > } >=20 > // while (len2 >=3D 3); >=20 > } >=20 > - >=20 > + >=20 > + } >=20 > + >=20 > offs +=3D 2; >=20 > if (offs =3D=3D numPairs) >=20 > break; >=20 > @@ -1709,6 +1848,12 @@ static unsigned GetOptimum(CLzmaEnc *p, > UInt32 position) > } >=20 > } >=20 > } >=20 > + >=20 > + do >=20 > + p->opt[last].price =3D kInfinityPrice; >=20 > + while (--last); >=20 > + >=20 > + return Backward(p, cur); >=20 > } >=20 >=20 >=20 >=20 >=20 > @@ -1735,21 +1880,23 @@ static unsigned GetOptimumFast(CLzmaEnc *p) > p->backRes =3D MARK_LIT; >=20 > if (numAvail < 2) >=20 > return 1; >=20 > + // if (mainLen < 2 && p->state =3D=3D 0) return 1; // 18.06.notused >=20 > if (numAvail > LZMA_MATCH_LEN_MAX) >=20 > numAvail =3D LZMA_MATCH_LEN_MAX; >=20 > data =3D p->matchFinder.GetPointerToCurrentPos(p->matchFinderObj) - = 1; >=20 > repLen =3D repIndex =3D 0; >=20 > - >=20 > + >=20 > for (i =3D 0; i < LZMA_NUM_REPS; i++) >=20 > { >=20 > unsigned len; >=20 > const Byte *data2 =3D data - p->reps[i]; >=20 > if (data[0] !=3D data2[0] || data[1] !=3D data2[1]) >=20 > continue; >=20 > - for (len =3D 2; len < numAvail && data[len] =3D=3D data2[len]; = len++); >=20 > + for (len =3D 2; len < numAvail && data[len] =3D=3D data2[len]; = len++) >=20 > + {} >=20 > if (len >=3D p->numFastBytes) >=20 > { >=20 > - p->backRes =3D i; >=20 > + p->backRes =3D (UInt32)i; >=20 > MOVE_POS(p, len - 1) >=20 > return len; >=20 > } >=20 > @@ -1768,7 +1915,7 @@ static unsigned GetOptimumFast(CLzmaEnc *p) > } >=20 >=20 >=20 > mainDist =3D 0; /* for GCC */ >=20 > - >=20 > + >=20 > if (mainLen >=3D 2) >=20 > { >=20 > mainDist =3D p->matches[(size_t)numPairs - 1]; >=20 > @@ -1793,18 +1940,18 @@ static unsigned GetOptimumFast(CLzmaEnc *p) > || (repLen + 2 >=3D mainLen && mainDist >=3D (1 << 9)) >=20 > || (repLen + 3 >=3D mainLen && mainDist >=3D (1 << 15))) >=20 > { >=20 > - p->backRes =3D repIndex; >=20 > + p->backRes =3D (UInt32)repIndex; >=20 > MOVE_POS(p, repLen - 1) >=20 > return repLen; >=20 > } >=20 > - >=20 > + >=20 > if (mainLen < 2 || numAvail <=3D 2) >=20 > return 1; >=20 >=20 >=20 > { >=20 > unsigned len1 =3D ReadMatchDistances(p, &p->numPairs); >=20 > p->longestMatchLen =3D len1; >=20 > - >=20 > + >=20 > if (len1 >=3D 2) >=20 > { >=20 > UInt32 newDist =3D p->matches[(size_t)p->numPairs - 1]; >=20 > @@ -1815,9 +1962,9 @@ static unsigned GetOptimumFast(CLzmaEnc *p) > return 1; >=20 > } >=20 > } >=20 > - >=20 > + >=20 > data =3D p->matchFinder.GetPointerToCurrentPos(p->matchFinderObj) - = 1; >=20 > - >=20 > + >=20 > for (i =3D 0; i < LZMA_NUM_REPS; i++) >=20 > { >=20 > unsigned len, limit; >=20 > @@ -1833,7 +1980,7 @@ static unsigned GetOptimumFast(CLzmaEnc *p) > break; >=20 > } >=20 > } >=20 > - >=20 > + >=20 > p->backRes =3D mainDist + LZMA_NUM_REPS; >=20 > if (mainLen !=3D 2) >=20 > { >=20 > @@ -1859,7 +2006,7 @@ static void WriteEndMarker(CLzmaEnc *p, > unsigned posState) > RC_BIT_0(&p->rc, prob) >=20 > } >=20 > p->state =3D kMatchNextStates[p->state]; >=20 > - >=20 > + >=20 > p->rc.range =3D range; >=20 > LenEnc_Encode(&p->lenProbs, &p->rc, 0, posState); >=20 > range =3D p->rc.range; >=20 > @@ -1888,7 +2035,7 @@ static void WriteEndMarker(CLzmaEnc *p, > unsigned posState) > } >=20 > while (--numBits); >=20 > } >=20 > - >=20 > + >=20 > { >=20 > // RcTree_ReverseEncode(&p->rc, p->posAlignEncoder, = kNumAlignBits, > kAlignMask); >=20 > CLzmaProb *probs =3D p->posAlignEncoder; >=20 > @@ -1932,23 +2079,22 @@ MY_NO_INLINE static SRes Flush(CLzmaEnc *p, > UInt32 nowPos) > } >=20 >=20 >=20 >=20 >=20 > - >=20 > -static void FillAlignPrices(CLzmaEnc *p) >=20 > +MY_NO_INLINE static void FillAlignPrices(CLzmaEnc *p) >=20 > { >=20 > unsigned i; >=20 > const CProbPrice *ProbPrices =3D p->ProbPrices; >=20 > const CLzmaProb *probs =3D p->posAlignEncoder; >=20 > - p->alignPriceCount =3D 0; >=20 > + // p->alignPriceCount =3D 0; >=20 > for (i =3D 0; i < kAlignTableSize / 2; i++) >=20 > { >=20 > UInt32 price =3D 0; >=20 > - unsigned symbol =3D i; >=20 > + unsigned sym =3D i; >=20 > unsigned m =3D 1; >=20 > unsigned bit; >=20 > UInt32 prob; >=20 > - bit =3D symbol & 1; symbol >>=3D 1; price +=3D = GET_PRICEa(probs[m], bit); m =3D > (m << 1) + bit; >=20 > - bit =3D symbol & 1; symbol >>=3D 1; price +=3D = GET_PRICEa(probs[m], bit); m =3D > (m << 1) + bit; >=20 > - bit =3D symbol & 1; symbol >>=3D 1; price +=3D = GET_PRICEa(probs[m], bit); m =3D > (m << 1) + bit; >=20 > + bit =3D sym & 1; sym >>=3D 1; price +=3D GET_PRICEa(probs[m], = bit); m =3D (m > << 1) + bit; >=20 > + bit =3D sym & 1; sym >>=3D 1; price +=3D GET_PRICEa(probs[m], = bit); m =3D (m > << 1) + bit; >=20 > + bit =3D sym & 1; sym >>=3D 1; price +=3D GET_PRICEa(probs[m], = bit); m =3D (m > << 1) + bit; >=20 > prob =3D probs[m]; >=20 > p->alignPrices[i ] =3D price + GET_PRICEa_0(prob); >=20 > p->alignPrices[i + 8] =3D price + GET_PRICEa_1(prob); >=20 > @@ -1957,78 +2103,97 @@ static void FillAlignPrices(CLzmaEnc *p) > } >=20 >=20 >=20 >=20 >=20 > -static void FillDistancesPrices(CLzmaEnc *p) >=20 > +MY_NO_INLINE static void FillDistancesPrices(CLzmaEnc *p) >=20 > { >=20 > + // int y; for (y =3D 0; y < 100; y++) { >=20 > + >=20 > UInt32 tempPrices[kNumFullDistances]; >=20 > - unsigned i, lenToPosState; >=20 > + unsigned i, lps; >=20 >=20 >=20 > const CProbPrice *ProbPrices =3D p->ProbPrices; >=20 > p->matchPriceCount =3D 0; >=20 >=20 >=20 > - for (i =3D kStartPosModelIndex; i < kNumFullDistances; i++) >=20 > + for (i =3D kStartPosModelIndex / 2; i < kNumFullDistances / 2; i++) >=20 > { >=20 > unsigned posSlot =3D GetPosSlot1(i); >=20 > - unsigned footerBits =3D ((posSlot >> 1) - 1); >=20 > + unsigned footerBits =3D (posSlot >> 1) - 1; >=20 > unsigned base =3D ((2 | (posSlot & 1)) << footerBits); >=20 > + const CLzmaProb *probs =3D p->posEncoders + (size_t)base * 2; >=20 > // tempPrices[i] =3D RcTree_ReverseGetPrice(p->posEncoders + = base, > footerBits, i - base, p->ProbPrices); >=20 > - >=20 > - const CLzmaProb *probs =3D p->posEncoders + base; >=20 > UInt32 price =3D 0; >=20 > unsigned m =3D 1; >=20 > - unsigned symbol =3D i - base; >=20 > + unsigned sym =3D i; >=20 > + unsigned offset =3D (unsigned)1 << footerBits; >=20 > + base +=3D i; >=20 > + >=20 > + if (footerBits) >=20 > do >=20 > { >=20 > - unsigned bit =3D symbol & 1; >=20 > - symbol >>=3D 1; >=20 > + unsigned bit =3D sym & 1; >=20 > + sym >>=3D 1; >=20 > price +=3D GET_PRICEa(probs[m], bit); >=20 > m =3D (m << 1) + bit; >=20 > } >=20 > while (--footerBits); >=20 > - tempPrices[i] =3D price; >=20 > + >=20 > + { >=20 > + unsigned prob =3D probs[m]; >=20 > + tempPrices[base ] =3D price + GET_PRICEa_0(prob); >=20 > + tempPrices[base + offset] =3D price + GET_PRICEa_1(prob); >=20 > + } >=20 > } >=20 >=20 >=20 > - for (lenToPosState =3D 0; lenToPosState < kNumLenToPosStates; > lenToPosState++) >=20 > + for (lps =3D 0; lps < kNumLenToPosStates; lps++) >=20 > { >=20 > - unsigned posSlot; >=20 > - const CLzmaProb *encoder =3D p->posSlotEncoder[lenToPosState]; >=20 > - UInt32 *posSlotPrices =3D p->posSlotPrices[lenToPosState]; >=20 > - unsigned distTableSize =3D p->distTableSize; >=20 > - const CLzmaProb *probs =3D encoder; >=20 > - for (posSlot =3D 0; posSlot < distTableSize; posSlot +=3D 2) >=20 > + unsigned slot; >=20 > + unsigned distTableSize2 =3D (p->distTableSize + 1) >> 1; >=20 > + UInt32 *posSlotPrices =3D p->posSlotPrices[lps]; >=20 > + const CLzmaProb *probs =3D p->posSlotEncoder[lps]; >=20 > + >=20 > + for (slot =3D 0; slot < distTableSize2; slot++) >=20 > { >=20 > - // posSlotPrices[posSlot] =3D RcTree_GetPrice(encoder, > kNumPosSlotBits, posSlot, p->ProbPrices); >=20 > - UInt32 price =3D 0; >=20 > + // posSlotPrices[slot] =3D RcTree_GetPrice(encoder, = kNumPosSlotBits, > slot, p->ProbPrices); >=20 > + UInt32 price; >=20 > unsigned bit; >=20 > - unsigned symbol =3D (posSlot >> 1) + (1 << (kNumPosSlotBits - = 1)); >=20 > - UInt32 prob; >=20 > - bit =3D symbol & 1; symbol >>=3D 1; price +=3D = GET_PRICEa(probs[symbol], > bit); >=20 > - bit =3D symbol & 1; symbol >>=3D 1; price +=3D = GET_PRICEa(probs[symbol], > bit); >=20 > - bit =3D symbol & 1; symbol >>=3D 1; price +=3D = GET_PRICEa(probs[symbol], > bit); >=20 > - bit =3D symbol & 1; symbol >>=3D 1; price +=3D = GET_PRICEa(probs[symbol], > bit); >=20 > - bit =3D symbol & 1; symbol >>=3D 1; price +=3D = GET_PRICEa(probs[symbol], > bit); >=20 > - prob =3D probs[(posSlot >> 1) + (1 << (kNumPosSlotBits - 1))]; >=20 > - posSlotPrices[posSlot ] =3D price + GET_PRICEa_0(prob); >=20 > - posSlotPrices[posSlot + 1] =3D price + GET_PRICEa_1(prob); >=20 > + unsigned sym =3D slot + (1 << (kNumPosSlotBits - 1)); >=20 > + unsigned prob; >=20 > + bit =3D sym & 1; sym >>=3D 1; price =3D GET_PRICEa(probs[sym], = bit); >=20 > + bit =3D sym & 1; sym >>=3D 1; price +=3D GET_PRICEa(probs[sym], = bit); >=20 > + bit =3D sym & 1; sym >>=3D 1; price +=3D GET_PRICEa(probs[sym], = bit); >=20 > + bit =3D sym & 1; sym >>=3D 1; price +=3D GET_PRICEa(probs[sym], = bit); >=20 > + bit =3D sym & 1; sym >>=3D 1; price +=3D GET_PRICEa(probs[sym], = bit); >=20 > + prob =3D probs[(size_t)slot + (1 << (kNumPosSlotBits - 1))]; >=20 > + posSlotPrices[(size_t)slot * 2 ] =3D price + = GET_PRICEa_0(prob); >=20 > + posSlotPrices[(size_t)slot * 2 + 1] =3D price + = GET_PRICEa_1(prob); >=20 > } >=20 > - for (posSlot =3D kEndPosModelIndex; posSlot < distTableSize; = posSlot++) >=20 > - posSlotPrices[posSlot] +=3D ((UInt32)(((posSlot >> 1) - 1) - > kNumAlignBits) << kNumBitPriceShiftBits); >=20 >=20 >=20 > { >=20 > - UInt32 *distancesPrices =3D p->distancesPrices[lenToPosState]; >=20 > + UInt32 delta =3D ((UInt32)((kEndPosModelIndex / 2 - 1) - > kNumAlignBits) << kNumBitPriceShiftBits); >=20 > + for (slot =3D kEndPosModelIndex / 2; slot < distTableSize2; = slot++) >=20 > { >=20 > - distancesPrices[0] =3D posSlotPrices[0]; >=20 > - distancesPrices[1] =3D posSlotPrices[1]; >=20 > - distancesPrices[2] =3D posSlotPrices[2]; >=20 > - distancesPrices[3] =3D posSlotPrices[3]; >=20 > + posSlotPrices[(size_t)slot * 2 ] +=3D delta; >=20 > + posSlotPrices[(size_t)slot * 2 + 1] +=3D delta; >=20 > + delta +=3D ((UInt32)1 << kNumBitPriceShiftBits); >=20 > } >=20 > + } >=20 > + >=20 > + { >=20 > + UInt32 *dp =3D p->distancesPrices[lps]; >=20 > + >=20 > + dp[0] =3D posSlotPrices[0]; >=20 > + dp[1] =3D posSlotPrices[1]; >=20 > + dp[2] =3D posSlotPrices[2]; >=20 > + dp[3] =3D posSlotPrices[3]; >=20 > + >=20 > for (i =3D 4; i < kNumFullDistances; i +=3D 2) >=20 > { >=20 > UInt32 slotPrice =3D posSlotPrices[GetPosSlot1(i)]; >=20 > - distancesPrices[i ] =3D slotPrice + tempPrices[i]; >=20 > - distancesPrices[i + 1] =3D slotPrice + tempPrices[i + 1]; >=20 > + dp[i ] =3D slotPrice + tempPrices[i]; >=20 > + dp[i + 1] =3D slotPrice + tempPrices[i + 1]; >=20 > } >=20 > } >=20 > } >=20 > + // } >=20 > } >=20 >=20 >=20 >=20 >=20 > @@ -2037,7 +2202,7 @@ void LzmaEnc_Construct(CLzmaEnc *p) > { >=20 > RangeEnc_Construct(&p->rc); >=20 > MatchFinder_Construct(&p->matchFinderBase); >=20 > - >=20 > + >=20 > #ifndef _7ZIP_ST >=20 > MatchFinderMt_Construct(&p->matchFinderMt); >=20 > p->matchFinderMt.MatchFinder =3D &p->matchFinderBase; >=20 > @@ -2081,7 +2246,7 @@ void LzmaEnc_Destruct(CLzmaEnc *p, ISzAllocPtr > alloc, ISzAllocPtr allocBig) > #ifndef _7ZIP_ST >=20 > MatchFinderMt_Destruct(&p->matchFinderMt, allocBig); >=20 > #endif >=20 > - >=20 > + >=20 > MatchFinder_Free(&p->matchFinderBase, allocBig); >=20 > LzmaEnc_FreeLits(p, alloc); >=20 > RangeEnc_Free(&p->rc, alloc); >=20 > @@ -2126,14 +2291,14 @@ static SRes LzmaEnc_CodeOneBlock(CLzmaEnc > *p, UInt32 maxPackSize, UInt32 maxUnpa > } >=20 >=20 >=20 > if (p->matchFinder.GetNumAvailableBytes(p->matchFinderObj) !=3D 0) >=20 > - >=20 > + >=20 > for (;;) >=20 > { >=20 > UInt32 dist; >=20 > unsigned len, posState; >=20 > UInt32 range, ttt, newBound; >=20 > CLzmaProb *probs; >=20 > - >=20 > + >=20 > if (p->fastMode) >=20 > len =3D GetOptimumFast(p); >=20 > else >=20 > @@ -2153,9 +2318,9 @@ static SRes LzmaEnc_CodeOneBlock(CLzmaEnc *p, > UInt32 maxPackSize, UInt32 maxUnpa > posState =3D (unsigned)nowPos32 & p->pbMask; >=20 > range =3D p->rc.range; >=20 > probs =3D &p->isMatch[p->state][posState]; >=20 > - >=20 > + >=20 > RC_BIT_PRE(&p->rc, probs) >=20 > - >=20 > + >=20 > dist =3D p->backRes; >=20 >=20 >=20 > #ifdef SHOW_STAT2 >=20 > @@ -2185,7 +2350,7 @@ static SRes LzmaEnc_CodeOneBlock(CLzmaEnc *p, > UInt32 maxPackSize, UInt32 maxUnpa > RC_BIT_1(&p->rc, probs); >=20 > probs =3D &p->isRep[p->state]; >=20 > RC_BIT_PRE(&p->rc, probs) >=20 > - >=20 > + >=20 > if (dist < LZMA_NUM_REPS) >=20 > { >=20 > RC_BIT_1(&p->rc, probs); >=20 > @@ -2245,10 +2410,7 @@ static SRes LzmaEnc_CodeOneBlock(CLzmaEnc > *p, UInt32 maxPackSize, UInt32 maxUnpa > if (len !=3D 1) >=20 > { >=20 > LenEnc_Encode(&p->repLenProbs, &p->rc, len - > LZMA_MATCH_LEN_MIN, posState); >=20 > - if (!p->fastMode) >=20 > - if (--p->repLenEnc.counters[posState] =3D=3D 0) >=20 > - LenPriceEnc_UpdateTable(&p->repLenEnc, posState, > &p->repLenProbs, p->ProbPrices); >=20 > - >=20 > + --p->repLenEncCounter; >=20 > p->state =3D kRepNextStates[p->state]; >=20 > } >=20 > } >=20 > @@ -2260,34 +2422,32 @@ static SRes LzmaEnc_CodeOneBlock(CLzmaEnc > *p, UInt32 maxPackSize, UInt32 maxUnpa > p->state =3D kMatchNextStates[p->state]; >=20 >=20 >=20 > LenEnc_Encode(&p->lenProbs, &p->rc, len - > LZMA_MATCH_LEN_MIN, posState); >=20 > - if (!p->fastMode) >=20 > - if (--p->lenEnc.counters[posState] =3D=3D 0) >=20 > - LenPriceEnc_UpdateTable(&p->lenEnc, posState, > &p->lenProbs, p->ProbPrices); >=20 > + // --p->lenEnc.counter; >=20 >=20 >=20 > dist -=3D LZMA_NUM_REPS; >=20 > p->reps[3] =3D p->reps[2]; >=20 > p->reps[2] =3D p->reps[1]; >=20 > p->reps[1] =3D p->reps[0]; >=20 > p->reps[0] =3D dist + 1; >=20 > - >=20 > + >=20 > p->matchPriceCount++; >=20 > GetPosSlot(dist, posSlot); >=20 > // RcTree_Encode_PosSlot(&p->rc, > p->posSlotEncoder[GetLenToPosState(len)], posSlot); >=20 > { >=20 > - UInt32 symbol =3D posSlot + (1 << kNumPosSlotBits); >=20 > + UInt32 sym =3D (UInt32)posSlot + (1 << kNumPosSlotBits); >=20 > range =3D p->rc.range; >=20 > probs =3D p->posSlotEncoder[GetLenToPosState(len)]; >=20 > do >=20 > { >=20 > - CLzmaProb *prob =3D probs + (symbol >> kNumPosSlotBits); >=20 > - UInt32 bit =3D (symbol >> (kNumPosSlotBits - 1)) & 1; >=20 > - symbol <<=3D 1; >=20 > + CLzmaProb *prob =3D probs + (sym >> kNumPosSlotBits); >=20 > + UInt32 bit =3D (sym >> (kNumPosSlotBits - 1)) & 1; >=20 > + sym <<=3D 1; >=20 > RC_BIT(&p->rc, prob, bit); >=20 > } >=20 > - while (symbol < (1 << kNumPosSlotBits * 2)); >=20 > + while (sym < (1 << kNumPosSlotBits * 2)); >=20 > p->rc.range =3D range; >=20 > } >=20 > - >=20 > + >=20 > if (dist >=3D kStartPosModelIndex) >=20 > { >=20 > unsigned footerBits =3D ((posSlot >> 1) - 1); >=20 > @@ -2295,7 +2455,7 @@ static SRes LzmaEnc_CodeOneBlock(CLzmaEnc *p, > UInt32 maxPackSize, UInt32 maxUnpa > if (dist < kNumFullDistances) >=20 > { >=20 > unsigned base =3D ((2 | (posSlot & 1)) << footerBits); >=20 > - RcTree_ReverseEncode(&p->rc, p->posEncoders + base, > footerBits, dist - base); >=20 > + RcTree_ReverseEncode(&p->rc, p->posEncoders + base, > footerBits, (unsigned)(dist /* - base */)); >=20 > } >=20 > else >=20 > { >=20 > @@ -2331,32 +2491,49 @@ static SRes LzmaEnc_CodeOneBlock(CLzmaEnc > *p, UInt32 maxPackSize, UInt32 maxUnpa > bit =3D dist & 1; dist >>=3D 1; RC_BIT(&p->rc, > p->posAlignEncoder + m, bit); m =3D (m << 1) + bit; >=20 > bit =3D dist & 1; RC_BIT(&p->rc, > p->posAlignEncoder + m, bit); >=20 > p->rc.range =3D range; >=20 > - p->alignPriceCount++; >=20 > + // p->alignPriceCount++; >=20 > } >=20 > } >=20 > } >=20 > } >=20 > } >=20 >=20 >=20 > - nowPos32 +=3D len; >=20 > + nowPos32 +=3D (UInt32)len; >=20 > p->additionalOffset -=3D len; >=20 > - >=20 > + >=20 > if (p->additionalOffset =3D=3D 0) >=20 > { >=20 > UInt32 processed; >=20 >=20 >=20 > if (!p->fastMode) >=20 > { >=20 > - if (p->matchPriceCount >=3D (1 << 7)) >=20 > + /* >=20 > + if (p->alignPriceCount >=3D 16) // kAlignTableSize >=20 > + FillAlignPrices(p); >=20 > + if (p->matchPriceCount >=3D 128) >=20 > FillDistancesPrices(p); >=20 > - if (p->alignPriceCount >=3D kAlignTableSize) >=20 > + if (p->lenEnc.counter <=3D 0) >=20 > + LenPriceEnc_UpdateTables(&p->lenEnc, 1 << p->pb, > &p->lenProbs, p->ProbPrices); >=20 > + */ >=20 > + if (p->matchPriceCount >=3D 64) >=20 > + { >=20 > FillAlignPrices(p); >=20 > + // { int y; for (y =3D 0; y < 100; y++) { >=20 > + FillDistancesPrices(p); >=20 > + // }} >=20 > + LenPriceEnc_UpdateTables(&p->lenEnc, 1 << p->pb, > &p->lenProbs, p->ProbPrices); >=20 > + } >=20 > + if (p->repLenEncCounter <=3D 0) >=20 > + { >=20 > + p->repLenEncCounter =3D REP_LEN_COUNT; >=20 > + LenPriceEnc_UpdateTables(&p->repLenEnc, 1 << p->pb, > &p->repLenProbs, p->ProbPrices); >=20 > + } >=20 > } >=20 > - >=20 > + >=20 > if (p->matchFinder.GetNumAvailableBytes(p->matchFinderObj) = =3D=3D 0) >=20 > break; >=20 > processed =3D nowPos32 - startPos32; >=20 > - >=20 > + >=20 > if (maxPackSize) >=20 > { >=20 > if (processed + kNumOpts + 300 >=3D maxUnpackSize >=20 > @@ -2430,7 +2607,7 @@ static SRes LzmaEnc_Alloc(CLzmaEnc *p, UInt32 > keepWindowSize, ISzAllocPtr alloc, > p->matchFinderObj =3D &p->matchFinderBase; >=20 > MatchFinder_CreateVTable(&p->matchFinderBase, &p->matchFinder); >=20 > } >=20 > - >=20 > + >=20 > return SZ_OK; >=20 > } >=20 >=20 >=20 > @@ -2490,12 +2667,19 @@ void LzmaEnc_Init(CLzmaEnc *p) >=20 >=20 > p->optEnd =3D 0; >=20 > p->optCur =3D 0; >=20 > + >=20 > + { >=20 > + for (i =3D 0; i < kNumOpts; i++) >=20 > + p->opt[i].price =3D kInfinityPrice; >=20 > + } >=20 > + >=20 > p->additionalOffset =3D 0; >=20 >=20 >=20 > p->pbMask =3D (1 << p->pb) - 1; >=20 > p->lpMask =3D ((UInt32)0x100 << p->lp) - ((unsigned)0x100 >> = p->lc); >=20 > } >=20 >=20 >=20 > + >=20 > void LzmaEnc_InitPrices(CLzmaEnc *p) >=20 > { >=20 > if (!p->fastMode) >=20 > @@ -2507,6 +2691,9 @@ void LzmaEnc_InitPrices(CLzmaEnc *p) > p->lenEnc.tableSize =3D >=20 > p->repLenEnc.tableSize =3D >=20 > p->numFastBytes + 1 - LZMA_MATCH_LEN_MIN; >=20 > + >=20 > + p->repLenEncCounter =3D REP_LEN_COUNT; >=20 > + >=20 > LenPriceEnc_UpdateTables(&p->lenEnc, 1 << p->pb, &p->lenProbs, > p->ProbPrices); >=20 > LenPriceEnc_UpdateTables(&p->repLenEnc, 1 << p->pb, = &p->repLenProbs, > p->ProbPrices); >=20 > } >=20 > @@ -2583,7 +2770,7 @@ typedef struct > ISeqOutStream vt; >=20 > Byte *data; >=20 > SizeT rem; >=20 > - Bool overflow; >=20 > + BoolInt overflow; >=20 > } CLzmaEnc_SeqOutStreamBuf; >=20 >=20 >=20 > static size_t SeqOutStreamBuf_Write(const ISeqOutStream *pp, const = void > *data, size_t size) >=20 > @@ -2615,7 +2802,7 @@ const Byte *LzmaEnc_GetCurBuf(CLzmaEncHandle > pp) > } >=20 >=20 >=20 >=20 >=20 > -SRes LzmaEnc_CodeOneMemBlock(CLzmaEncHandle pp, Bool reInit, >=20 > +SRes LzmaEnc_CodeOneMemBlock(CLzmaEncHandle pp, BoolInt reInit, >=20 > Byte *dest, size_t *destLen, UInt32 desiredPackSize, UInt32 > *unpackSize) >=20 > { >=20 > CLzmaEnc *p =3D (CLzmaEnc *)pp; >=20 > @@ -2644,7 +2831,7 @@ SRes > LzmaEnc_CodeOneMemBlock(CLzmaEncHandle pp, Bool reInit, > return SZ_ERROR_OUTPUT_EOF; >=20 >=20 >=20 > res =3D LzmaEnc_CodeOneBlock(p, desiredPackSize, *unpackSize); >=20 > - >=20 > + >=20 > *unpackSize =3D (UInt32)(p->nowPos64 - nowPos64); >=20 > *destLen -=3D outStream.rem; >=20 > if (outStream.overflow) >=20 > @@ -2679,7 +2866,7 @@ static SRes LzmaEnc_Encode2(CLzmaEnc *p, > ICompressProgress *progress) > } >=20 > } >=20 > } >=20 > - >=20 > + >=20 > LzmaEnc_Finish(p); >=20 >=20 >=20 > /* >=20 > @@ -2751,7 +2938,7 @@ SRes LzmaEnc_MemEncode(CLzmaEncHandle pp, > Byte *dest, SizeT *destLen, const Byte > p->rc.outStream =3D &outStream.vt; >=20 >=20 >=20 > res =3D LzmaEnc_MemPrepare(pp, src, srcLen, 0, alloc, allocBig); >=20 > - >=20 > + >=20 > if (res =3D=3D SZ_OK) >=20 > { >=20 > res =3D LzmaEnc_Encode2(p, progress); >=20 > diff --git a/BaseTools/Source/C/LzmaCompress/Sdk/DOC/lzma-history.txt > b/BaseTools/Source/C/LzmaCompress/Sdk/DOC/lzma-history.txt > index d7426d38a4..0f9560c7a6 100644 > --- a/BaseTools/Source/C/LzmaCompress/Sdk/DOC/lzma-history.txt > +++ b/BaseTools/Source/C/LzmaCompress/Sdk/DOC/lzma-history.txt > @@ -1,13 +1,35 @@ > HISTORY of the LZMA SDK >=20 > ----------------------- >=20 >=20 >=20 > +19.00 2019-02-21 >=20 > +------------------------- >=20 > +- Encryption strength for 7z archives was increased: >=20 > + the size of random initialization vector was increased from 64-bit = to > 128-bit, >=20 > + and the pseudo-random number generator was improved. >=20 > +- The bug in 7zIn.c code was fixed. >=20 > + >=20 > + >=20 > +18.06 2018-12-30 >=20 > +------------------------- >=20 > +- The speed for LZMA/LZMA2 compressing was increased by 3-10%, >=20 > + and there are minor changes in compression ratio. >=20 > +- Some bugs were fixed. >=20 > +- The bug in 7-Zip 18.02-18.05 was fixed: >=20 > + There was memory leak in multithreading xz decoder - > XzDecMt_Decode(), >=20 > + if xz stream contains only one block. >=20 > +- The changes for MSVS compiler makefiles: >=20 > + - the makefiles now use "PLATFORM" macroname with values (x64, = x86, > arm64) >=20 > + instead of "CPU" macroname with values (AMD64, ARM64). >=20 > + - the makefiles by default now use static version of the run-time library. >=20 > + >=20 > + >=20 > 18.05 2018-04-30 >=20 > ------------------------- >=20 > -- The speed for LZMA/LZMA2 compressing was increased >=20 > - by 8% for fastest/fast compression levels and >=20 > +- The speed for LZMA/LZMA2 compressing was increased >=20 > + by 8% for fastest/fast compression levels and >=20 > by 3% for normal/maximum compression levels. >=20 > - Previous versions of 7-Zip could work incorrectly in "Large memory pages" > mode in >=20 > - Windows 10 because of some BUG with "Large Pages" in Windows 10. >=20 > + Windows 10 because of some BUG with "Large Pages" in Windows 10. >=20 > Now 7-Zip doesn't use "Large Pages" on Windows 10 up to revision = 1709 > (16299). >=20 > - The BUG was fixed in Lzma2Enc.c >=20 > Lzma2Enc_Encode2() function worked incorretly, >=20 > @@ -16,7 +38,7 @@ HISTORY of the LZMA SDK >=20 >=20 > 18.03 beta 2018-03-04 >=20 > ------------------------- >=20 > -- Asm\x86\LzmaDecOpt.asm: new optimized LZMA decoder written in asm >=20 > +- Asm\x86\LzmaDecOpt.asm: new optimized LZMA decoder written in asm >=20 > for x64 with about 30% higher speed than main version of LZMA = decoder > written in C. >=20 > - The speed for single-thread LZMA/LZMA2 decoder written in C was > increased by 3%. >=20 > - 7-Zip now can use multi-threading for 7z/LZMA2 decoding, >=20 > @@ -35,7 +57,7 @@ HISTORY of the LZMA SDK > 18.00 beta 2019-01-10 >=20 > ------------------------- >=20 > - The BUG in xz encoder was fixed: >=20 > - There was memory leak of 16 KB for each file compressed with >=20 > + There was memory leak of 16 KB for each file compressed with >=20 > xz compression method, if additional filter was used. >=20 >=20 >=20 >=20 >=20 > @@ -44,7 +66,7 @@ HISTORY of the LZMA SDK > - Minor speed optimization for LZMA2 (xz and 7z) multi-threading > compression. >=20 > 7-Zip now uses additional memory buffers for multi-block LZMA2 > compression. >=20 > CPU utilization was slightly improved. >=20 > -- 7-zip now creates multi-block xz archives by default. Block size = can be >=20 > +- 7-zip now creates multi-block xz archives by default. Block size = can be >=20 > specified with -ms[Size]{m|g} switch. >=20 > - xz decoder now can unpack random block from multi-block xz = archives. >=20 > - 7-Zip command line: @listfile now doesn't work after -- switch. >=20 > @@ -55,7 +77,7 @@ HISTORY of the LZMA SDK >=20 >=20 > 17.00 beta 2017-04-29 >=20 > ------------------------- >=20 > -- NewHandler.h / NewHandler.cpp: >=20 > +- NewHandler.h / NewHandler.cpp: >=20 > now it redefines operator new() only for old MSVC compilers > (_MSC_VER < 1900). >=20 > - C/7zTypes.h : the names of variables in interface structures were changed > (vt). >=20 > - Some bugs were fixed. 7-Zip could crash in some cases. >=20 > @@ -76,51 +98,51 @@ HISTORY of the LZMA SDK > 16.02 2016-05-21 >=20 > ------------------------- >=20 > - The BUG in 16.00 - 16.01 was fixed: >=20 > - Split Handler (SplitHandler.cpp) returned incorrect >=20 > + Split Handler (SplitHandler.cpp) returned incorrect >=20 > total size value (kpidSize) for split archives. >=20 >=20 >=20 >=20 >=20 > 16.01 2016-05-19 >=20 > -------------------------- >=20 > +------------------------- >=20 > - Some internal changes to reduce the number of compiler warnings. >=20 >=20 >=20 >=20 >=20 > 16.00 2016-05-10 >=20 > -------------------------- >=20 > +------------------------- >=20 > - Some bugs were fixed. >=20 >=20 >=20 >=20 >=20 > 15.12 2015-11-19 >=20 > -------------------------- >=20 > +------------------------- >=20 > - The BUG in C version of 7z decoder was fixed: >=20 > 7zDec.c : SzDecodeLzma2() >=20 > 7z decoder could mistakenly report about decoding error for some 7z > archives >=20 > that use LZMA2 compression method. >=20 > - The probability to get that mistaken decoding error report was = about >=20 > - one error per 16384 solid blocks for solid blocks larger than 16 KB > (compressed size). >=20 > + The probability to get that mistaken decoding error report was = about >=20 > + one error per 16384 solid blocks for solid blocks larger than 16 KB > (compressed size). >=20 > - The BUG (in 9.26-15.11) in C version of 7z decoder was fixed: >=20 > 7zArcIn.c : SzReadHeader2() >=20 > - 7z decoder worked incorrectly for 7z archives that contain >=20 > - empty solid blocks, that can be placed to 7z archive, if some file = is >=20 > + 7z decoder worked incorrectly for 7z archives that contain >=20 > + empty solid blocks, that can be placed to 7z archive, if some file = is >=20 > unavailable for reading during archive creation. >=20 >=20 >=20 >=20 >=20 > 15.09 beta 2015-10-16 >=20 > -------------------------- >=20 > +------------------------- >=20 > - The BUG in LZMA / LZMA2 encoding code was fixed. >=20 > The BUG in LzFind.c::MatchFinder_ReadBlock() function. >=20 > If input data size is larger than (4 GiB - dictionary_size), >=20 > the following code worked incorrectly: >=20 > - - LZMA : LzmaEnc_MemEncode(), LzmaEncode() : LZMA encoding > functions >=20 > - for compressing from memory to memory. >=20 > + - LZMA : LzmaEnc_MemEncode(), LzmaEncode() : LZMA encoding > functions >=20 > + for compressing from memory to memory. >=20 > That BUG is not related to LZMA encoder version that works via > streams. >=20 > - - LZMA2 : multi-threaded version of LZMA2 encoder worked = incorrectly, > if >=20 > - default value of chunk size (CLzma2EncProps::blockSize) is = changed >=20 > + - LZMA2 : multi-threaded version of LZMA2 encoder worked = incorrectly, > if >=20 > + default value of chunk size (CLzma2EncProps::blockSize) is = changed >=20 > to value larger than (4 GiB - dictionary_size). >=20 >=20 >=20 >=20 >=20 > 9.38 beta 2015-01-03 >=20 > -------------------------- >=20 > +------------------------- >=20 > - The BUG in 9.31-9.37 was fixed: >=20 > IArchiveGetRawProps interface was disabled for 7z archives. >=20 > - The BUG in 9.26-9.36 was fixed: >=20 > @@ -128,10 +150,10 @@ HISTORY of the LZMA SDK >=20 >=20 >=20 >=20 > 9.36 beta 2014-12-26 >=20 > -------------------------- >=20 > +------------------------- >=20 > - The BUG in command line version was fixed: >=20 > 7-Zip created temporary archive in current folder during update = archive >=20 > - operation, if -w{Path} switch was not specified. >=20 > + operation, if -w{Path} switch was not specified. >=20 > The fixed 7-Zip creates temporary archive in folder that contains updated > archive. >=20 > - The BUG in 9.33-9.35 was fixed: >=20 > 7-Zip silently ignored file reading errors during 7z or gz archive creation, >=20 > @@ -140,14 +162,14 @@ HISTORY of the LZMA SDK >=20 >=20 >=20 >=20 > 9.35 beta 2014-12-07 >=20 > -------------------------- >=20 > +------------------------- >=20 > - 7zr.exe now support AES encryption. >=20 > - SFX modules were added to LZMA SDK >=20 > - Some bugs were fixed. >=20 >=20 >=20 >=20 >=20 > 9.21 beta 2011-04-11 >=20 > -------------------------- >=20 > +------------------------- >=20 > - New class FString for file names at file systems. >=20 > - Speed optimization in CRC code for big-endian CPUs. >=20 > - The BUG in Lzma2Dec.c was fixed: >=20 > @@ -155,7 +177,7 @@ HISTORY of the LZMA SDK >=20 >=20 >=20 >=20 > 9.18 beta 2010-11-02 >=20 > -------------------------- >=20 > +------------------------- >=20 > - New small SFX module for installers (SfxSetup). >=20 >=20 >=20 >=20 >=20 > @@ -168,7 +190,7 @@ HISTORY of the LZMA SDK > 9.11 beta 2010-03-15 >=20 > ------------------------- >=20 > - PPMd compression method support >=20 > - >=20 > + >=20 >=20 >=20 > 9.09 2009-12-12 >=20 > ------------------------- >=20 > @@ -202,7 +224,7 @@ HISTORY of the LZMA SDK > 4.61 beta 2008-11-23 >=20 > ------------------------- >=20 > - The bug in ANSI-C LZMA Decoder was fixed: >=20 > - If encoded stream was corrupted, decoder could access memory >=20 > + If encoded stream was corrupted, decoder could access memory >=20 > outside of allocated range. >=20 > - Some changes in ANSI-C 7z Decoder interfaces. >=20 > - LZMA SDK is placed in the public domain. >=20 > @@ -216,7 +238,7 @@ HISTORY of the LZMA SDK > 4.59 beta 2008-08-13 >=20 > ------------------------- >=20 > - The bug was fixed: >=20 > - LZMA Encoder in fast compression mode could access memory outside > of >=20 > + LZMA Encoder in fast compression mode could access memory outside > of >=20 > allocated range in some rare cases. >=20 >=20 >=20 >=20 >=20 > @@ -229,7 +251,7 @@ HISTORY of the LZMA SDK >=20 >=20 > 4.57 2007-12-12 >=20 > ------------------------- >=20 > -- Speed optimizations in ?++ LZMA Decoder. >=20 > +- Speed optimizations in ?++ LZMA Decoder. >=20 > - Small changes for more compatibility with some C/C++ compilers. >=20 >=20 >=20 >=20 >=20 > @@ -239,36 +261,36 @@ HISTORY of the LZMA SDK > - now it supports BCJ and BCJ2 filters >=20 > - now it supports files larger than 4 GB. >=20 > - now it supports "Last Write Time" field for files. >=20 > -- C++ code for .7z archives compressing/decompressing from 7-zip >=20 > +- C++ code for .7z archives compressing/decompressing from 7-zip >=20 > was included to LZMA SDK. >=20 > - >=20 > + >=20 >=20 >=20 > 4.43 2006-06-04 >=20 > ------------------------- >=20 > - Small changes for more compatibility with some C/C++ compilers. >=20 > - >=20 > + >=20 >=20 >=20 > 4.42 2006-05-15 >=20 > ------------------------- >=20 > - Small changes in .h files in ANSI-C version. >=20 > - >=20 > + >=20 >=20 >=20 > 4.39 beta 2006-04-14 >=20 > ------------------------- >=20 > - The bug in versions 4.33b:4.38b was fixed: >=20 > - C++ version of LZMA encoder could not correctly compress >=20 > + C++ version of LZMA encoder could not correctly compress >=20 > files larger than 2 GB with HC4 match finder (-mfhc4). >=20 > - >=20 > + >=20 >=20 >=20 > 4.37 beta 2005-04-06 >=20 > ------------------------- >=20 > -- Fixes in C++ code: code could no be compiled if _NO_EXCEPTIONS was > defined. >=20 > +- Fixes in C++ code: code could no be compiled if _NO_EXCEPTIONS was > defined. >=20 >=20 >=20 >=20 >=20 > 4.35 beta 2005-03-02 >=20 > ------------------------- >=20 > - The bug was fixed in C++ version of LZMA Decoder: >=20 > - If encoded stream was corrupted, decoder could access memory >=20 > + If encoded stream was corrupted, decoder could access memory >=20 > outside of allocated range. >=20 >=20 >=20 >=20 >=20 > @@ -339,7 +361,7 @@ HISTORY of the LZMA SDK >=20 >=20 > 4.17 2005-04-18 >=20 > ------------------------- >=20 > -- New example for RAM->RAM compressing/decompressing: >=20 > +- New example for RAM->RAM compressing/decompressing: >=20 > LZMA + BCJ (filter for x86 code): >=20 > - LzmaRam.h >=20 > - LzmaRam.cpp >=20 > @@ -350,11 +372,11 @@ HISTORY of the LZMA SDK >=20 >=20 > 4.16 2005-03-29 >=20 > ------------------------- >=20 > -- The bug was fixed in LzmaDecode.c (ANSI-C LZMA Decoder): >=20 > +- The bug was fixed in LzmaDecode.c (ANSI-C LZMA Decoder): >=20 > If _LZMA_OUT_READ was defined, and if encoded stream was = corrupted, >=20 > decoder could access memory outside of allocated range. >=20 > - Speed optimization of ANSI-C LZMA Decoder (now it's about 20% = faster). >=20 > - Old version of LZMA Decoder now is in file LzmaDecodeSize.c. >=20 > + Old version of LZMA Decoder now is in file LzmaDecodeSize.c. >=20 > LzmaDecodeSize.c can provide slightly smaller code than = LzmaDecode.c >=20 > - Small speed optimization in LZMA C++ code >=20 > - filter for SPARC's code was added >=20 > @@ -369,7 +391,7 @@ HISTORY of the LZMA SDK >=20 >=20 > 4.05 2004-08-25 >=20 > ------------------------- >=20 > -- Source code of filters for x86, IA-64, ARM, ARM-Thumb >=20 > +- Source code of filters for x86, IA-64, ARM, ARM-Thumb >=20 > and PowerPC code was included to SDK >=20 > - Some internal minor changes >=20 >=20 >=20 > @@ -381,8 +403,8 @@ HISTORY of the LZMA SDK >=20 >=20 > 4.03 2004-06-18 >=20 > ------------------------- >=20 > -- "Benchmark" command was added. It measures compressing >=20 > - and decompressing speed and shows rating values. >=20 > +- "Benchmark" command was added. It measures compressing >=20 > + and decompressing speed and shows rating values. >=20 > Also it checks hardware errors. >=20 >=20 >=20 >=20 >=20 > @@ -411,7 +433,7 @@ HISTORY of the LZMA SDK >=20 >=20 > HISTORY of the LZMA >=20 > ------------------- >=20 > - 2001-2008: Improvements to LZMA compressing/decompressing code, >=20 > + 2001-2008: Improvements to LZMA compressing/decompressing code, >=20 > keeping compatibility with original LZMA format >=20 > 1996-2001: Development of LZMA compression format >=20 >=20 >=20 > @@ -419,6 +441,6 @@ HISTORY of the LZMA >=20 >=20 > 2001-08-30: LZMA compression was added to 7-Zip >=20 > 1999-01-02: First version of 7-Zip was released >=20 > - >=20 > + >=20 >=20 >=20 > End of document >=20 > diff --git a/BaseTools/Source/C/LzmaCompress/Sdk/DOC/lzma-sdk.txt > b/BaseTools/Source/C/LzmaCompress/Sdk/DOC/lzma-sdk.txt > index a3deb20943..e17cd4fe1a 100644 > --- a/BaseTools/Source/C/LzmaCompress/Sdk/DOC/lzma-sdk.txt > +++ b/BaseTools/Source/C/LzmaCompress/Sdk/DOC/lzma-sdk.txt > @@ -1,4 +1,4 @@ > -LZMA SDK 18.05 >=20 > +LZMA SDK 19.00 >=20 > -------------- >=20 >=20 >=20 > LZMA SDK provides the documentation, samples, header files, >=20 > -- > 2.29.2.windows.3 >=20 >=20 >=20 > -=3D-=3D-=3D-=3D-=3D-=3D > Groups.io Links: You receive all messages sent to this group. > View/Reply Online (#69675): = https://edk2.groups.io/g/devel/message/69675 > Mute This Topic: https://groups.io/mt/79445451/4905953 > Group Owner: devel+owner@edk2.groups.io > Unsubscribe: https://edk2.groups.io/g/devel/unsub > [gaoliming@byosoft.com.cn] > -=3D-=3D-=3D-=3D-=3D-=3D >=20