diff options
author | Liming Gao <liming.gao@intel.com> | 2017-04-14 00:13:06 +0800 |
---|---|---|
committer | Liming Gao <liming.gao@intel.com> | 2017-04-14 10:53:21 +0800 |
commit | 321ec73af789e7ed6d0ce2f9e79501d79db5e267 (patch) | |
tree | 641271b33a0772b0ff5a4ca565e8061dd576bd12 /MdeModulePkg | |
parent | fc3ce2f30c690b2e54ed2a5da283c87abe924743 (diff) | |
download | edk2-platforms-321ec73af789e7ed6d0ce2f9e79501d79db5e267.tar.xz |
MdeModulePkg BrotliLib: Fix the regression logic issue in loop
In V2, change logic to avoid use mtf[-1] style to get value.
Roll back to previous logic, and use point + offset to get byte value.
Cc: Bell Song <binx.song@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Bell Song <binx.song@intel.com>
(cherry picked from commit 2c8d2545f59bf00f0b2460dbeabee6645d130d3e)
Diffstat (limited to 'MdeModulePkg')
-rw-r--r-- | MdeModulePkg/Library/BrotliCustomDecompressLib/dec/decode.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/MdeModulePkg/Library/BrotliCustomDecompressLib/dec/decode.c b/MdeModulePkg/Library/BrotliCustomDecompressLib/dec/decode.c index 67f0ff2cd9..6557ba67d5 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 = 4;
uint32_t upper_bound = state->mtf_upper_bound;
uint8_t* mtf = &state->mtf[4]; /* Make mtf[-1] addressable. */
+ uint8_t* mtft = &state->mtf[3];
/* Load endian-aware constant. */
const uint8_t b0123[4] = {0, 1, 2, 3};
uint32_t pattern;
@@ -875,10 +876,10 @@ static BROTLI_NOINLINE void InverseMoveToFrontTransform( uint8_t value = mtf[index];
upper_bound |= (uint32_t)v[i];
v[i] = value;
- mtf[-1] = value;
- while (index > 0) {
+ mtft[0] = value;
+ while (index >= 0) {
+ mtft[index + 1] = mtft[index];
index--;
- mtf[index + 1] = mtf[index];
}
}
/* Remember amount of elements to be reinitialized. */
|