1 #ifndef TREES_H_ 2 #define TREES_H_ 3 4 /* Constants */ 5 6 #define DIST_CODE_LEN 512 7 /* see definition of array dist_code in trees.c */ 8 9 #define MAX_BL_BITS 7 10 /* Bit length codes must not exceed MAX_BL_BITS bits */ 11 12 #define REP_3_6 16 13 /* repeat previous bit length 3-6 times (2 bits of repeat count) */ 14 15 #define REPZ_3_10 17 16 /* repeat a zero length 3-10 times (3 bits of repeat count) */ 17 18 #define REPZ_11_138 18 19 /* repeat a zero length 11-138 times (7 bits of repeat count) */ 20 21 static const int extra_lbits[LENGTH_CODES] /* extra bits for each length code */ 22 = {0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0}; 23 24 static const int extra_dbits[D_CODES] /* extra bits for each distance code */ 25 = {0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13}; 26 27 static const int extra_blbits[BL_CODES] /* extra bits for each bit length code */ 28 = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7}; 29 30 static const unsigned char bl_order[BL_CODES] 31 = {16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15}; 32 /* The lengths of the bit length codes are sent in order of decreasing 33 * probability, to avoid transmitting the lengths for unused bit length codes. 34 */ 35 36 37 /* Function definitions */ 38 void gen_codes (ct_data *tree, int max_code, uint16_t *bl_count); 39 40 #endif 41