Uncompressed block now added to out a little bit more efficient.

This commit is contained in:
Timofey Solomko
2016-12-09 11:29:36 +03:00
parent 1bee90aa8f
commit 5e0a174fb6
+4 -1
View File
@@ -70,8 +70,11 @@ public class Deflate: DecompressionAlgorithm {
// Process uncompressed data into the output
// TODO: Replace precondition with guard and error throwing.
precondition(pointerData.bitMask == 1, "Misaligned byte.")
var ind = out.count
out.append(contentsOf: Array(repeating: 0, count: length))
for _ in 0..<length {
out.append(pointerData.alignedByte())
out[ind] = pointerData.alignedByte()
ind += 1
}
} else if blockType == [1, 0] || blockType == [0, 1] {
// Block with Huffman coding (either static or dynamic)