if last && state.block_open != 2 { /* Emit end of previous block */
quick_end_block!(false); /* Emit start of last block */
quick_start_block!(last);
} elseif state.block_open == 0 && state.lookahead > 0 { /* Start new block only when we have lookahead data, so that if no
input data is given an empty block will not be written */
quick_start_block!(last);
}
loop { if state.bit_writer.pending.pending + State::BIT_BUF_SIZE.div_ceil(8) as usize
>= state.pending_buf_size()
{
flush_pending(stream);
state = &mut stream.state; if stream.avail_out == 0 { returnif last
&& stream.avail_in == 0
&& state.bit_writer.bits_used == 0
&& state.block_open == 0
{
BlockState::FinishStarted
} else {
BlockState::NeedMore
};
}
}
if state.lookahead < MIN_LOOKAHEAD {
fill_window(stream);
state = &mut stream.state;
if state.lookahead < MIN_LOOKAHEAD && matches!(flush, DeflateFlush::NoFlush) { return BlockState::NeedMore;
} if state.lookahead == 0 { break;
}
if state.block_open == 0 { // Start new block when we have lookahead data, // so that if no input data is given an empty block will not be written
quick_start_block!(last);
}
}
let lc: u8; if state.lookahead >= WANT_MIN_MATCH {
macro_rules! first_four_bytes {
($slice:expr, $offset:expr) => {
u32::from_le_bytes($slice[$offset..$offset + 4].try_into().unwrap())
};
}
let str_val = { let str_start = &state.window.filled()[state.strstart..];
first_four_bytes!(str_start, 0)
}; let hash_head = StandardHashCalc::quick_insert_value(state, state.strstart, str_val); let dist = state.strstart as isize - hash_head as isize;
if dist <= state.max_dist() as isize && dist > 0 { let match_start = &state.window.filled()[hash_head as usize..];
// TODO do this with a debug_assert? // check_match(s, state.strstart, hash_head, match_len);
// The `dist` value is a distance within the window, // and MAX_WBITS == 15 (32k), hence a u16 can always represent this value. let dist = u16::try_from(dist).unwrap();
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.