         private var range: Int
         private var code: Int
         private(set) var isCorrupted: Bool
+
+        var isFinishedOK: Bool {
+            return self.code == 0
+        }
 
         init?(pointerData: inout DataWithPointer) {
             self.isCorrupted = false

                    state -= 6
                }
                uncompressedSize -= 1
            }

        }

        var state = 0

        func decodeLiteral(_ state: Int, _ rep0: Int) {
            let prevByte = outWindow.isEmpty ? 0 : outWindow.byte(at: 1)
            // TODO: Something is not quite right.
            var symbol = 1
            let litState = ((outWindow.totalPosition & ((1 << lp.toInt()) - 1)) << lc.toInt()) + (prevByte >> (8 - lc)).toInt()
            let probsIndex = 0x300 * litState
            if state >= 7 {
                var matchByte = outWindow.byte(at: rep0 + 1)
