gzip2: small simplification in mainSimpleSort()

function                                             old     new   delta
mainQSort3                                          1165    1163      -2

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
Denys Vlasenko 2018-02-03 19:11:00 +01:00
parent 0599a137ba
commit 10f516500e

View File

@ -468,15 +468,16 @@ void mainSimpleSort(uint32_t* ptr,
int32_t d, int32_t d,
int32_t* budget) int32_t* budget)
{ {
int32_t bigN; /* At which increment to start? */
int hp; int hp = 0;
{
bigN = hi - lo + 1; int bigN = hi - lo;
if (bigN < 2) return; if (bigN <= 0)
return;
hp = 0; while (incs[hp] <= bigN)
while (incs[hp] < bigN) hp++; hp++;
hp--; hp--;
}
for (; hp >= 0; hp--) { for (; hp >= 0; hp--) {
int32_t i; int32_t i;
@ -754,22 +755,22 @@ void mainSort(EState* state,
#if CONFIG_BZIP2_FAST >= 2 #if CONFIG_BZIP2_FAST >= 2
for (; i >= 3; i -= 4) { for (; i >= 3; i -= 4) {
quadrant[i] = 0; quadrant[i] = 0;
j = (j >> 8) | (((uint16_t)block[i]) << 8); j = (j >> 8) | (((unsigned)block[i]) << 8);
ftab[j]++; ftab[j]++;
quadrant[i-1] = 0; quadrant[i-1] = 0;
j = (j >> 8) | (((uint16_t)block[i-1]) << 8); j = (j >> 8) | (((unsigned)block[i-1]) << 8);
ftab[j]++; ftab[j]++;
quadrant[i-2] = 0; quadrant[i-2] = 0;
j = (j >> 8) | (((uint16_t)block[i-2]) << 8); j = (j >> 8) | (((unsigned)block[i-2]) << 8);
ftab[j]++; ftab[j]++;
quadrant[i-3] = 0; quadrant[i-3] = 0;
j = (j >> 8) | (((uint16_t)block[i-3]) << 8); j = (j >> 8) | (((unsigned)block[i-3]) << 8);
ftab[j]++; ftab[j]++;
} }
#endif #endif
for (; i >= 0; i--) { for (; i >= 0; i--) {
quadrant[i] = 0; quadrant[i] = 0;
j = (j >> 8) | (((uint16_t)block[i]) << 8); j = (j >> 8) | (((unsigned)block[i]) << 8);
ftab[j]++; ftab[j]++;
} }