summaryrefslogtreecommitdiffstats
path: root/mtester.h
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--mtester.h39
1 files changed, 20 insertions, 19 deletions
diff --git a/mtester.h b/mtester.h
index f4da88f..795d8e4 100644
--- a/mtester.h
+++ b/mtester.h
@@ -37,16 +37,16 @@ public:
at_stream_end( false )
{}
- void load()
- {
- for( int i = 0; i < 5; ++i ) code = (code << 8) | get_byte();
- code &= range; // make sure that first byte is discarded
- }
-
bool code_is_zero() const { return ( code == 0 ); }
bool finished() { return pos >= buffer_size; }
long member_position() const { return pos; }
+ uint8_t get_byte()
+ {
+ if( finished() ) return 0xAA; // make code != 0
+ return buffer[pos++];
+ }
+
const File_trailer * get_trailer()
{
if( buffer_size - pos < File_trailer::size ) return 0;
@@ -55,10 +55,10 @@ public:
return p;
}
- uint8_t get_byte()
+ void load()
{
- if( finished() ) return 0xAA; // make code != 0
- return buffer[pos++];
+ for( int i = 0; i < 5; ++i ) code = (code << 8) | get_byte();
+ code &= range; // make sure that first byte is discarded
}
void normalize()
@@ -195,13 +195,13 @@ class LZ_mtester
Range_mtester rdec;
const unsigned dictionary_size;
const int buffer_size;
- uint8_t * buffer; // output buffer
- int pos; // current pos in buffer
- int stream_pos; // first byte not yet written to file
+ uint8_t * buffer; /* output buffer */
+ int pos; /* current pos in buffer */
+ int stream_pos; /* first byte not yet written to file */
uint32_t crc_;
- unsigned rep0; // rep[0-3] latest four distances
- unsigned rep1; // used for efficient coding of
- unsigned rep2; // repeated distances
+ unsigned rep0; /* rep[0-3] latest four distances */
+ unsigned rep1; /* used for efficient coding of */
+ unsigned rep2; /* repeated distances */
unsigned rep3;
State state;
@@ -219,18 +219,17 @@ class LZ_mtester
Len_model match_len_model;
Len_model rep_len_model;
- unsigned long long stream_position() const
- { return partial_data_pos + stream_pos; }
void flush_data();
bool verify_trailer();
+ void print_block( const int len );
- uint8_t get_prev_byte() const
+ uint8_t peek_prev() const
{
const int i = ( ( pos > 0 ) ? pos : buffer_size ) - 1;
return buffer[i];
}
- uint8_t get_byte( const int distance ) const
+ uint8_t peek( const int distance ) const
{
int i = pos - distance - 1;
if( i < 0 ) i += buffer_size;
@@ -289,6 +288,8 @@ public:
void duplicate_buffer();
int test_member( const long pos_limit = LONG_MAX );
+ int debug_decode_member( const long long dpos, const long long mpos,
+ const bool show_packets );
};