Call copy_from32 in a trival 1-iteration loop.

Follow-up commits will re-try copy_from32's across I/O boundaries.
This commit is contained in:
Nigel Tao committed 2017-10-07 11:50:50 +11:00
1 parent 2efdf5fab6
commit 0e09aa8c10
3 files changed
+40 -31

No files matched your search

+8 -4
View File
@@ -187,12 +187,16 @@ pri func decoder.decode_uncompressed?(dst writer1, src reader1)() {
}
this.n_bits = 0
var n u32 = in.src.read_u32le?()
if (n.low_bits(n:16) + n.high_bits(n:16)) != 0xFFFF {
var length u32 = in.src.read_u32le?()
if (length.low_bits(n:16) + length.high_bits(n:16)) != 0xFFFF {
return error "inconsistent stored block length"
}
// TODO: drop the "?" from "copy_from32?"?
in.dst.copy_from32?(r:in.src, n:n.low_bits(n:16))
length = length.low_bits(n:16)
while length > 0 {
// TODO: drop the "?" from "copy_from32?"?
in.dst.copy_from32?(r:in.src, n:length)
break
}
}
pri func decoder.decode_huffman?(dst writer1, src reader1)() {