summaryrefslogtreecommitdiffstats
path: root/decoder.cc
diff options
context:
space:
mode:
Diffstat (limited to 'decoder.cc')
-rw-r--r--decoder.cc15
1 files changed, 6 insertions, 9 deletions
diff --git a/decoder.cc b/decoder.cc
index 0cb6188..6c0c775 100644
--- a/decoder.cc
+++ b/decoder.cc
@@ -125,12 +125,11 @@ bool LZ_decoder::verify_trailer( const Pretty_print & pp ) const
// 3 = trailer error, 4 = unknown marker found.
int LZ_decoder::decode_member( const Pretty_print & pp )
{
- unsigned int rep0 = 0;
- unsigned int rep1 = 0;
- unsigned int rep2 = 0;
+ unsigned int rep0 = 0; // rep[0-3] latest four distances
+ unsigned int rep1 = 0; // used for efficient coding of
+ unsigned int rep2 = 0; // repeated distances
unsigned int rep3 = 0;
State state;
- uint8_t prev_byte = 0;
while( true )
{
@@ -139,11 +138,10 @@ int LZ_decoder::decode_member( const Pretty_print & pp )
if( range_decoder.decode_bit( bm_match[state()][pos_state] ) == 0 )
{
if( state.is_char() )
- prev_byte = literal_decoder.decode( range_decoder, prev_byte );
+ put_byte( literal_decoder.decode( range_decoder, get_byte( 0 ) ) );
else
- prev_byte = literal_decoder.decode_matched( range_decoder, prev_byte,
- get_byte( rep0 ) );
- put_byte( prev_byte );
+ put_byte( literal_decoder.decode_matched( range_decoder, get_byte( 0 ),
+ get_byte( rep0 ) ) );
state.set_char();
}
else
@@ -222,7 +220,6 @@ int LZ_decoder::decode_member( const Pretty_print & pp )
state.set_match();
}
copy_block( rep0, len );
- prev_byte = get_byte( 0 );
}
}
}