bzip2: move ->origPtr out of struct EState, make a few members smaller

function                                             old     new   delta
BZ2_compressBlock                                    223     228      +5
BZ2_blockSort                                         85      88      +3
generateMTFValues                                    356     357      +1
handle_compress                                      355     349      -6
compressStream                                       538     531      -7
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 3/2 up/down: 9/-13)              Total: -4 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
Denys Vlasenko
2018-02-03 20:50:20 +01:00
parent c9ae8d770b
commit 86be6d5ba9
3 changed files with 27 additions and 27 deletions

View File

@@ -120,9 +120,11 @@ typedef struct EState {
/* mode this stream is in, and whether inputting */
/* or outputting data */
int32_t mode;
//both smallint?
int32_t state;
uint8_t mode;
uint8_t state;
/* misc administratium */
uint8_t blockSize100k;
/* remembers avail_in when flush/finish requested */
/* bbox: not needed, strm->avail_in always has the same value */
@@ -130,12 +132,11 @@ typedef struct EState {
/* uint32_t avail_in_expect; */
/* for doing the block sorting */
int32_t origPtr;
uint32_t *arr1;
uint32_t *arr2;
uint32_t *ftab;
uint16_t* quadrant;
uint16_t *quadrant;
int32_t budget;
/* aliases for arr1 and arr2 */
@@ -144,10 +145,6 @@ typedef struct EState {
uint16_t *mtfv;
uint8_t *zbits;
/* guess what */
uint32_t *crc32table;
//move down
/* run-length-encoding of the input */
uint32_t state_in_ch;
int32_t state_in_len;
@@ -156,21 +153,22 @@ typedef struct EState {
int32_t nblock;
int32_t nblockMAX;
//int32_t numZ; // index into s->zbits[], replaced by pointer:
uint8_t *posZ;
uint8_t *state_out_pos;
uint8_t *posZ;
uint8_t *state_out_pos;
/* the buffer for bit stream creation */
uint32_t bsBuff;
int32_t bsLive;
/* guess what */
uint32_t *crc32table;
/* block and combined CRCs */
uint32_t blockCRC;
uint32_t combinedCRC;
/* misc administratium */
int32_t blockNo;
int32_t blockSize100k;
//smallint?
/* stuff for coding the MTF values */
int32_t nMTF;
@@ -206,7 +204,7 @@ typedef struct EState {
/*-- compression. --*/
static void
static int32_t
BZ2_blockSort(EState*);
static void