static void
lz_decoder_reset(lzma_coder *coder)
{
- coder->dict.pos = 2 * LZ_DICT_REPEAT_MAX;
+ coder->dict.pos = LZ_DICT_INIT_POS;
coder->dict.full = 0;
- coder->dict.buf[2 * LZ_DICT_REPEAT_MAX - 1] = '\0';
+ coder->dict.buf[LZ_DICT_INIT_POS - 1] = '\0';
coder->dict.has_wrapped = false;
coder->dict.need_reset = false;
return;
/// LZMA's longest match length is 273 so pick a multiple of 16 above that.
#define LZ_DICT_REPEAT_MAX 288
+/// Initial position in lzma_dict.buf when the dictionary is empty.
+#define LZ_DICT_INIT_POS (2 * LZ_DICT_REPEAT_MAX)
+
typedef struct {
/// Pointer to the dictionary buffer.
// Update how full the dictionary is.
if (!dict->has_wrapped)
- dict->full = dict->pos - 2 * LZ_DICT_REPEAT_MAX;
+ dict->full = dict->pos - LZ_DICT_INIT_POS;
return *len != 0;
}
dict->buf[dict->pos++] = byte;
if (!dict->has_wrapped)
- dict->full = dict->pos - 2 * LZ_DICT_REPEAT_MAX;
+ dict->full = dict->pos - LZ_DICT_INIT_POS;
}
dict->buf, &dict->pos, dict->limit);
if (!dict->has_wrapped)
- dict->full = dict->pos - 2 * LZ_DICT_REPEAT_MAX;
+ dict->full = dict->pos - LZ_DICT_INIT_POS;
return;
}