add --eof-in-length option

This commit is contained in:
2022-09-26 23:41:17 +02:00
parent b12c8f8d93
commit 8715dede0e
5 changed files with 33 additions and 7 deletions

View File

@@ -21,7 +21,7 @@ pub fn pack(
if let Some(m) = match_finder.matches(pos).next() {
let max_offset = 1 << (m.length * 3 - 1).min(31);
let offset = pos - m.pos;
if offset < max_offset {
if offset < max_offset && m.length >= config.min_length() {
lz::Op::Match {
offset: offset as u32,
len: m.length as u32,
@@ -40,7 +40,7 @@ pub fn pack(
.zip(data[(pos - offset)..].iter())
.take_while(|(a, b)| a == b)
.count();
if length > 0 {
if length >= config.min_length() {
lz::Op::Match {
offset: offset as u32,
len: length as u32,