macro_rules! lazy_decide {
(
best_len = $bl:expr,
best_off = $bo:expr,
target_len = $target:expr,
lazy_depth = $depth:expr,
abs_pos = $abs:expr,
lit_len = $lit:expr,
history_end = $hist:expr,
min_match = $mm:expr,
search = |$p:ident, $l:ident| $search:expr $(,)?
) => {{
let best_len = $bl;
let best_off = $bo;
let abs_pos = $abs;
let history_end = $hist;
let min_match = $mm;
if best_len >= $target || abs_pos + 1 + min_match > history_end {
::core::option::Option::None
} else {
let lit_len = $lit;
let next1 = {
let $p = abs_pos + 1;
let $l = lit_len + 1;
$search
};
let win1 = ::core::matches!(&next1, ::core::option::Option::Some(n)
if n.match_len > best_len
|| (n.match_len == best_len && n.offset < best_off));
if win1 {
::core::option::Option::Some(next1)
} else if $depth >= 2 && abs_pos + 2 + min_match <= history_end {
let next2 = {
let $p = abs_pos + 2;
let $l = lit_len + 2;
$search
};
let win2 = ::core::matches!(&next2, ::core::option::Option::Some(n)
if n.match_len > best_len + 1);
if win2 {
::core::option::Option::Some(next1)
} else {
::core::option::Option::None
}
} else {
::core::option::Option::None
}
}
}};
}
pub(crate) use lazy_decide;
#[cfg(test)]
mod tests;