From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 5DB3A21A04811 for ; Thu, 13 Apr 2017 19:48:41 -0700 (PDT) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga105.fm.intel.com with ESMTP; 13 Apr 2017 19:48:41 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.37,195,1488873600"; d="scan'208";a="73941976" Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by orsmga002.jf.intel.com with ESMTP; 13 Apr 2017 19:48:40 -0700 Received: from fmsmsx117.amr.corp.intel.com (10.18.116.17) by FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS) id 14.3.319.2; Thu, 13 Apr 2017 19:48:40 -0700 Received: from shsmsx151.ccr.corp.intel.com (10.239.6.50) by fmsmsx117.amr.corp.intel.com (10.18.116.17) with Microsoft SMTP Server (TLS) id 14.3.319.2; Thu, 13 Apr 2017 19:48:40 -0700 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.246]) by SHSMSX151.ccr.corp.intel.com ([169.254.3.224]) with mapi id 14.03.0319.002; Fri, 14 Apr 2017 10:48:37 +0800 From: "Song, BinX" To: "Gao, Liming" , "edk2-devel@lists.01.org" Thread-Topic: [PATCH v2] MdeModulePkg BrotliLib: Fix the regression logic issue in loop Thread-Index: AQHStMLx9V10On4Jh0GP7x2YQiNzpaHEIUgg Date: Fri, 14 Apr 2017 02:48:36 +0000 Message-ID: <559D2DF22BC9A3468B4FA1AA547F0EF10255B954@shsmsx102.ccr.corp.intel.com> References: <1492135199-20880-1-git-send-email-liming.gao@intel.com> In-Reply-To: <1492135199-20880-1-git-send-email-liming.gao@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [PATCH v2] MdeModulePkg BrotliLib: Fix the regression logic issue in loop X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Apr 2017 02:48:41 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Bell Song Best Regards, Bell Song > -----Original Message----- > From: Gao, Liming > Sent: Friday, April 14, 2017 10:00 AM > To: edk2-devel@lists.01.org > Cc: Song, BinX > Subject: [PATCH v2] MdeModulePkg BrotliLib: Fix the regression logic issu= e in > loop >=20 > In V2, change logic to avoid use mtf[-1] style to get value. >=20 > Roll back to previous logic, and use point + offset to get byte value. >=20 > Cc: Bell Song > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Liming Gao > --- > MdeModulePkg/Library/BrotliCustomDecompressLib/dec/decode.c | 7 ++++--- > 1 file changed, 4 insertions(+), 3 deletions(-) >=20 > diff --git a/MdeModulePkg/Library/BrotliCustomDecompressLib/dec/decode.c > b/MdeModulePkg/Library/BrotliCustomDecompressLib/dec/decode.c > index 67f0ff2..6557ba6 100644 > --- a/MdeModulePkg/Library/BrotliCustomDecompressLib/dec/decode.c > +++ b/MdeModulePkg/Library/BrotliCustomDecompressLib/dec/decode.c > @@ -855,6 +855,7 @@ static BROTLI_NOINLINE void > InverseMoveToFrontTransform( > uint32_t i =3D 4; > uint32_t upper_bound =3D state->mtf_upper_bound; > uint8_t* mtf =3D &state->mtf[4]; /* Make mtf[-1] addressable. */ > + uint8_t* mtft =3D &state->mtf[3]; > /* Load endian-aware constant. */ > const uint8_t b0123[4] =3D {0, 1, 2, 3}; > uint32_t pattern; > @@ -875,10 +876,10 @@ static BROTLI_NOINLINE void > InverseMoveToFrontTransform( > uint8_t value =3D mtf[index]; > upper_bound |=3D (uint32_t)v[i]; > v[i] =3D value; > - mtf[-1] =3D value; > - while (index > 0) { > + mtft[0] =3D value; > + while (index >=3D 0) { > + mtft[index + 1] =3D mtft[index]; > index--; > - mtf[index + 1] =3D mtf[index]; > } > } > /* Remember amount of elements to be reinitialized. */ > -- > 2.8.0.windows.1