mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-18 08:32:11 +01:00
Have deflate slow-Huffman use extended ringbuffer
This is the same optimization as commit e65c8612 "Extend std/deflate
ringbuffer to simplify copies", applied to decoder.decode_huffman_slow.
This commit is contained in:
1 parent
010e0a69f4
commit
bb8623b472
2 files changed
+5
-34
No files matched your search
@@ -228,7 +228,7 @@ pri func decoder.decode_huffman_slow?(dst: base.io_writer, src: base.io_reader)
|
||||
// Copy from hdist to the end of this.history.
|
||||
while true {
|
||||
n_copied = args.dst.limited_copy_u32_from_slice!(
|
||||
up_to: hlen, s: this.history[hdist & 0x7FFF .. 0x8000])
|
||||
up_to: hlen, s: this.history[hdist & 0x7FFF ..])
|
||||
if hlen <= n_copied {
|
||||
hlen = 0
|
||||
break
|
||||
@@ -243,20 +243,6 @@ pri func decoder.decode_huffman_slow?(dst: base.io_writer, src: base.io_reader)
|
||||
}
|
||||
yield? base."$short write"
|
||||
} endwhile
|
||||
// Copy from the start of this.history, if we wrapped around.
|
||||
if hlen > 0 {
|
||||
while true {
|
||||
n_copied = args.dst.limited_copy_u32_from_slice!(
|
||||
up_to: hlen, s: this.history[hdist & 0x7FFF .. 0x8000])
|
||||
if hlen <= n_copied {
|
||||
hlen = 0
|
||||
break
|
||||
}
|
||||
hlen -= n_copied
|
||||
hdist ~mod+= n_copied
|
||||
yield? base."$short write"
|
||||
} endwhile
|
||||
}
|
||||
|
||||
if length == 0 {
|
||||
// No need to copy from args.dst.
|
||||
|
||||
Reference in new issue
Block a user