From df0793376dcaf0429ded8a82d7857de7fdc3637e Mon Sep 17 00:00:00 2001 From: Timofey Solomko Date: Wed, 3 May 2017 20:55:05 +0300 Subject: [PATCH] Another small refactoring. --- Sources/LZMADecoder.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Sources/LZMADecoder.swift b/Sources/LZMADecoder.swift index 827fad98..26bdc414 100644 --- a/Sources/LZMADecoder.swift +++ b/Sources/LZMADecoder.swift @@ -68,7 +68,7 @@ final class LZMADecoder { /// Is used to select exact variable from 'IsRep', 'IsRepG0', 'IsRepG1' and 'IsRepG2' arrays. private var state: Int = 0 - /// An array for storing output data + /// An array for storing output data. var out: [UInt8] = [] // This array will also serve as dictionary and out window. private var dictStart = 0 @@ -231,7 +231,7 @@ final class LZMADecoder { Byte in output at position that is the `distance` bytes before current position, where the `distance` is the distance from the latest decoded match. */ - var matchByte = out[rep0 + 1 <= dictEnd ? dictEnd - rep0 - 1 : dictionarySize - rep0 - 1 + dictEnd] + var matchByte = self.byte(at: rep0 + 1) repeat { let matchBit = ((matchByte >> 7) & 1).toInt() matchByte <<= 1