* [Patch] MdeModulePkg BrotliLib: Fix the regression logic issue in loop
@ 2017-04-13 10:36 Liming Gao
0 siblings, 0 replies; only message in thread
From: Liming Gao @ 2017-04-13 10:36 UTC (permalink / raw)
To: edk2-devel
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>
---
MdeModulePkg/Library/BrotliCustomDecompressLib/dec/decode.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/MdeModulePkg/Library/BrotliCustomDecompressLib/dec/decode.c b/MdeModulePkg/Library/BrotliCustomDecompressLib/dec/decode.c
index 67f0ff2..420d1bb 100644
--- a/MdeModulePkg/Library/BrotliCustomDecompressLib/dec/decode.c
+++ b/MdeModulePkg/Library/BrotliCustomDecompressLib/dec/decode.c
@@ -872,14 +872,14 @@ static BROTLI_NOINLINE void InverseMoveToFrontTransform(
upper_bound = 0;
for (i = 0; i < v_len; ++i) {
int index = v[i];
- uint8_t value = mtf[index];
+ uint8_t value = *(mtf + index);
upper_bound |= (uint32_t)v[i];
v[i] = value;
- mtf[-1] = value;
- while (index > 0) {
+ *(mtf - 1) = value;
+ do {
index--;
- mtf[index + 1] = mtf[index];
- }
+ *(mtf + index + 1) = *(mtf + index);
+ } while (index >= 0);
}
/* Remember amount of elements to be reinitialized. */
state->mtf_upper_bound = upper_bound;
--
2.8.0.windows.1
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2017-04-13 10:36 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-04-13 10:36 [Patch] MdeModulePkg BrotliLib: Fix the regression logic issue in loop Liming Gao
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox