summaryrefslogtreecommitdiffstats
path: root/encoder.cc
diff options
context:
space:
mode:
Diffstat (limited to 'encoder.cc')
-rw-r--r--encoder.cc12
1 files changed, 6 insertions, 6 deletions
diff --git a/encoder.cc b/encoder.cc
index 0876742..cc43337 100644
--- a/encoder.cc
+++ b/encoder.cc
@@ -101,8 +101,8 @@ Matchfinder_base::Matchfinder_base( const int before, const int dict_size,
dictionary_size_ = dict_size;
pos_limit = buffer_size;
if( !at_stream_end ) pos_limit -= after_size;
- int size = 1 << std::max( 16, real_bits( dictionary_size_ - 1 ) - 2 );
- if( dictionary_size_ > 1 << 26 )
+ unsigned size = 1 << std::max( 16, real_bits( dictionary_size_ - 1 ) - 2 );
+ if( dictionary_size_ > 1 << 26 ) // 64 MiB
size >>= 1;
key4_mask = size - 1;
size += num_prev_positions23;
@@ -336,7 +336,7 @@ void LZ_encoder::fill_distance_prices()
// Return value == number of bytes advanced (ahead).
-// trials[0]..trials[retval-1] contain the steps to encode.
+// 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],
@@ -690,7 +690,7 @@ bool LZ_encoder::encode_member( const unsigned long long member_size )
const uint8_t cur_byte = matchfinder[0];
renc.encode_bit( bm_match[state()][0], 0 );
encode_literal( prev_byte, cur_byte );
- crc32.update( crc_, cur_byte );
+ crc32.update_byte( crc_, cur_byte );
matchfinder.get_match_pairs();
matchfinder.move_pos();
}
@@ -720,7 +720,7 @@ bool LZ_encoder::encode_member( const unsigned long long member_size )
{
const uint8_t prev_byte = matchfinder[-ahead-1];
const uint8_t cur_byte = matchfinder[-ahead];
- crc32.update( crc_, cur_byte );
+ crc32.update_byte( crc_, cur_byte );
if( state.is_char() )
encode_literal( prev_byte, cur_byte );
else
@@ -732,7 +732,7 @@ bool LZ_encoder::encode_member( const unsigned long long member_size )
}
else // match or repeated match
{
- crc32.update( crc_, matchfinder.ptr_to_current_pos() - ahead, len );
+ crc32.update_buf( crc_, matchfinder.ptr_to_current_pos() - ahead, len );
mtf_reps( dis, rep_distances );
bit = ( dis < num_rep_distances );
renc.encode_bit( bm_rep[state()], bit );