summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko2018-02-03 17:44:00 +0100
committerDenys Vlasenko2018-02-03 17:44:00 +0100
commitc364d32ccc030c04b5289f0ffea0197f4ff7e666 (patch)
tree1a3b780ada8c85296bad2ffdd2bd34ba76aa3588
parentdf23f55e395d78d9cfc0fc5054651f5da58dcf25 (diff)
downloadbusybox-c364d32ccc030c04b5289f0ffea0197f4ff7e666.zip
busybox-c364d32ccc030c04b5289f0ffea0197f4ff7e666.tar.gz
bzip2: runningOrder[] values are always 0..255, make it uint8
function old new delta mainSort 1171 1124 -47 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--archival/libarchive/bz/blocksort.c9
-rw-r--r--archival/libarchive/bz/bzlib_private.h2
2 files changed, 5 insertions, 6 deletions
diff --git a/archival/libarchive/bz/blocksort.c b/archival/libarchive/bz/blocksort.c
index 473244d..c2d5f15 100644
--- a/archival/libarchive/bz/blocksort.c
+++ b/archival/libarchive/bz/blocksort.c
@@ -732,7 +732,7 @@ void mainSort(EState* state,
int32_t i, j;
Bool bigDone[256];
/* bbox: moved to EState to save stack
- int32_t runningOrder[256];
+ uint8_t runningOrder[256];
int32_t copyStart[256];
int32_t copyEnd [256];
*/
@@ -833,16 +833,15 @@ void mainSort(EState* state,
/*h = h / 3;*/
h = (h * 171) >> 9; /* bbox: fast h/3 */
for (i = h; i <= 255; i++) {
- int32_t vv;
- vv = runningOrder[i];
+ unsigned vv;
+ vv = runningOrder[i]; /* uint8[] */
j = i;
while (BIGFREQ(runningOrder[j-h]) > BIGFREQ(vv)) {
runningOrder[j] = runningOrder[j-h];
j = j - h;
if (j <= (h - 1))
- goto zero;
+ break;
}
- zero:
runningOrder[j] = vv;
}
} while (h != 1);
diff --git a/archival/libarchive/bz/bzlib_private.h b/archival/libarchive/bz/bzlib_private.h
index 8e44a8e..4acaef8 100644
--- a/archival/libarchive/bz/bzlib_private.h
+++ b/archival/libarchive/bz/bzlib_private.h
@@ -192,7 +192,7 @@ typedef struct EState {
int32_t BZ2_hbMakeCodeLengths__weight[BZ_MAX_ALPHA_SIZE * 2];
int32_t BZ2_hbMakeCodeLengths__parent[BZ_MAX_ALPHA_SIZE * 2];
- int32_t mainSort__runningOrder[256];
+ uint8_t mainSort__runningOrder[256];
int32_t mainSort__copyStart[256];
int32_t mainSort__copyEnd[256];
} EState;