/// Returns true if there are no bytes in this ReadBuf #[inline] pubfn is_empty(&self) -> bool { self.filled == 0
}
/// Clears the buffer, resetting the filled region to empty. /// /// The number of initialized bytes is not changed, and the contents of the buffer are not modified. #[inline] pubfn clear(&mutself) { self.buf.as_mut_slice().fill(0); self.filled = 0;
}
#[inline(always)] pubfn push_lit(&mutself, byte: u8) { // NOTE: we rely on the buffer being zeroed here! self.buf.as_mut_slice()[self.filled + 2] = byte;
// Write both dist bytes as a single 2-byte store. This avoids the // `movb %ch, [mem]` instruction pattern (store from high-byte register // alias) that LLVM otherwise emits when dist arrives as a wide register. // That pattern triggers the Intel Raptor Lake CPU errata, causing silent // 2-byte stores that corrupt the adjacent `len` byte. // SAFETY: buf has at least 3 bytes (guaranteed above), so the unaligned // 2-byte write at offset 0 stays within bounds. unsafe {
core::ptr::write_unaligned(buf.as_mut_ptr().cast::<[u8; 2]>(), dist.to_le_bytes())
};
buf[2] = len;
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.