Drop std/deflate's "Re-purpose the hdist variable"

This commit is contained in:
Nigel Tao committed 2021-11-20 22:03:29 +11:00
1 parent 49a431f98d
commit 5e8b448c12
5 files changed
+12 -31

No files matched your search

+2 -6
View File
@@ -324,18 +324,14 @@ pri func decoder.decode_huffman_fast32!(dst: base.io_writer, src: base.io_reader
if this.history_index < hdist {
return "#bad distance"
}
// Re-purpose the hdist variable as the this.history index to
// start copying from.
hdist = this.history_index - hdist
// Copy from hdist to the end of this.history.
// Copy from this.history[(this.history_index - hdist) ..].
//
// This copying is simpler than the decode_huffman_slow version
// because it cannot yield. We have already checked that
// args.dst.length() is large enough.
args.dst.limited_copy_u32_from_slice!(
up_to: hlen, s: this.history[hdist & 0x7FFF ..])
up_to: hlen, s: this.history[(this.history_index - hdist) & 0x7FFF ..])
if length == 0 {
// No need to copy from args.dst.
continue.loop