diff options
author | entrpntr <entrpntr@gmail.com> | 2020-05-28 06:44:10 -0400 |
---|---|---|
committer | entrpntr <entrpntr@gmail.com> | 2020-06-14 15:07:27 -0400 |
commit | 4ac8bcc29a4ad5bb908b692baa040e7c7eb21249 (patch) | |
tree | d4e14bd6d9c367a1d5993dc9729451a3770f9870 /tools/lz/main.c | |
parent | 4517c08edaa6783fac0fb15dd98b476e066134f8 (diff) |
Checkpoint where things mostly work.
Diffstat (limited to 'tools/lz/main.c')
-rw-r--r-- | tools/lz/main.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/tools/lz/main.c b/tools/lz/main.c index 428a027f..62e6dc41 100644 --- a/tools/lz/main.c +++ b/tools/lz/main.c @@ -37,13 +37,16 @@ struct command * compress (const unsigned char * data, unsigned short * size, un } else { struct command * compressed_sequences[COMPRESSION_METHODS]; unsigned short lengths[COMPRESSION_METHODS]; - unsigned flags = compressor -> methods; + unsigned flags = 0; for (current = 0; current < COMPRESSION_METHODS; current ++) { lengths[current] = *size; - if (!flags) flags = (++ compressor) -> methods; - compressed_sequences[current] = compressor -> function(data, bitflipped, lengths + current, -- flags); + if (flags == compressor -> methods) { + flags = 0; + compressor ++; + } + compressed_sequences[current] = compressor -> function(data, bitflipped, lengths + current, flags ++); } - result = select_command_sequence(compressed_sequences, lengths, COMPRESSION_METHODS, size); + result = select_optimal_sequence(compressed_sequences, lengths, size); for (current = 0; current < COMPRESSION_METHODS; current ++) free(compressed_sequences[current]); } free(bitflipped); |