summaryrefslogtreecommitdiffstats
path: root/encoder.cc
diff options
context:
space:
mode:
authorDaniel Baumann <mail@daniel-baumann.ch>2015-11-07 10:00:31 +0000
committerDaniel Baumann <mail@daniel-baumann.ch>2015-11-07 10:00:31 +0000
commit3f2a7dc31b4309fbd1a946b0fc3317764f0eb905 (patch)
tree382b32f3f4cd342b2858c258e7beca901e5ca506 /encoder.cc
parentAdding upstream version 1.15~rc1. (diff)
downloadlzip-3f2a7dc31b4309fbd1a946b0fc3317764f0eb905.tar.xz
lzip-3f2a7dc31b4309fbd1a946b0fc3317764f0eb905.zip
Adding upstream version 1.15.upstream/1.15
Signed-off-by: Daniel Baumann <mail@daniel-baumann.ch>
Diffstat (limited to 'encoder.cc')
-rw-r--r--encoder.cc23
1 files changed, 11 insertions, 12 deletions
diff --git a/encoder.cc b/encoder.cc
index cc43337..563fd64 100644
--- a/encoder.cc
+++ b/encoder.cc
@@ -141,8 +141,7 @@ int Matchfinder::get_match_pairs( struct Pair * pairs )
int maxlen = min_match_len - 1;
int num_pairs = 0;
- const int min_pos = (pos > dictionary_size_) ?
- pos - dictionary_size_ : 0;
+ const int min_pos = ( pos > dictionary_size_ ) ? pos - dictionary_size_ : 0;
const uint8_t * const data = buffer + pos;
unsigned tmp = crc32[data[0]] ^ data[1];
@@ -310,14 +309,14 @@ void LZ_encoder::fill_distance_prices()
const int base = ( 2 | ( dis_slot & 1 ) ) << direct_bits;
const int price = price_symbol_reversed( bm_dis + base - dis_slot - 1,
dis - base, direct_bits );
- for( int dis_state = 0; dis_state < max_dis_states; ++dis_state )
- dis_prices[dis_state][dis] = price;
+ for( int len_state = 0; len_state < len_states; ++len_state )
+ dis_prices[len_state][dis] = price;
}
- for( int dis_state = 0; dis_state < max_dis_states; ++dis_state )
+ for( int len_state = 0; len_state < len_states; ++len_state )
{
- int * const dsp = dis_slot_prices[dis_state];
- const Bit_model * const bmds = bm_dis_slot[dis_state];
+ int * const dsp = dis_slot_prices[len_state];
+ const Bit_model * const bmds = bm_dis_slot[len_state];
int slot = 0;
for( ; slot < end_dis_model && slot < num_dis_slots; ++slot )
dsp[slot] = price_symbol( bmds, slot, dis_slot_bits );
@@ -325,7 +324,7 @@ void LZ_encoder::fill_distance_prices()
dsp[slot] = price_symbol( bmds, slot, dis_slot_bits ) +
(((( slot >> 1 ) - 1 ) - dis_align_bits ) << price_shift_bits );
- int * const dp = dis_prices[dis_state];
+ int * const dp = dis_prices[len_state];
int dis = 0;
for( ; dis < start_dis_model; ++dis )
dp[dis] = dsp[dis];
@@ -335,10 +334,10 @@ void LZ_encoder::fill_distance_prices()
}
-// Return value == number of bytes advanced (ahead).
-// trials[0]..trials[ahead-1] contain the steps to encode.
-// ( trials[0].dis == -1 && trials[0].price == 1 ) means literal.
-//
+/* Return value == number of bytes advanced (ahead).
+ trials[0]..trials[ahead-1] contain the steps to encode.
+ ( trials[0].dis == -1 && trials[0].price == 1 ) means literal.
+*/
int LZ_encoder::sequence_optimizer( const int reps[num_rep_distances],
const State state )
{