1
0
Fork 0
mirror of https://git.tukaani.org/xz.git synced 2024-04-04 12:36:23 +02:00

Eliminate lzma_lz_encoder.must_move_pos. It's needed

only in one place which isn't performance criticial.
This commit is contained in:
Lasse Collin 2008-01-10 17:13:42 +02:00
parent 382808514a
commit f73c2ab607
2 changed files with 2 additions and 8 deletions

View file

@ -179,10 +179,8 @@ lzma_lz_encoder_reset(lzma_lz_encoder *lz, lzma_allocator *allocator,
} }
} }
// Allocation successful. Store the new size and calculate // Allocation successful. Store the new size.
// must_move_pos.
lz->size = buffer_size; lz->size = buffer_size;
lz->must_move_pos = lz->size - lz->keep_size_after;
// Reset in window variables. // Reset in window variables.
lz->offset = 0; lz->offset = 0;
@ -373,7 +371,7 @@ fill_window(lzma_coder *coder, lzma_allocator *allocator, const uint8_t *in,
lzma_ret ret; lzma_ret ret;
// Move the sliding window if needed. // Move the sliding window if needed.
if (coder->lz.read_pos >= coder->lz.must_move_pos) if (coder->lz.read_pos >= coder->lz.size - coder->lz.keep_size_after)
move_window(&coder->lz); move_window(&coder->lz);
if (coder->next.code == NULL) { if (coder->next.code == NULL) {

View file

@ -72,10 +72,6 @@ struct lzma_lz_encoder_s {
/// to buffer[write_pos]. /// to buffer[write_pos].
size_t write_pos; size_t write_pos;
/// When read_pos >= must_move_pos, move_window() must be called
/// to make more space for the input data.
size_t must_move_pos;
/// Number of bytes that must be kept available in our input history. /// Number of bytes that must be kept available in our input history.
/// That is, once keep_size_before bytes have been processed, /// That is, once keep_size_before bytes have been processed,
/// buffer[read_pos - keep_size_before] is the oldest byte that /// buffer[read_pos - keep_size_before] is the oldest byte that