From d32185633932585196cdf0fd245eb84cabab3684 Mon Sep 17 00:00:00 2001 From: Timofey Solomko Date: Sun, 13 Nov 2016 19:10:55 +0300 Subject: [PATCH] A small cleanup in HuffmanTable initializer. --- Sources/HuffmanTable.swift | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/Sources/HuffmanTable.swift b/Sources/HuffmanTable.swift index e3f954c4..92b7a19c 100644 --- a/Sources/HuffmanTable.swift +++ b/Sources/HuffmanTable.swift @@ -28,9 +28,6 @@ class HuffmanTable: CustomStringConvertible { var lengths: [HuffmanLength] - let minBits: Int - let maxBits: Int - var description: String { return self.lengths.reduce("HuffmanTable:\n") { $0.appending("\($1)\n") } } @@ -50,7 +47,6 @@ class HuffmanTable: CustomStringConvertible { } start = finish bits = endbits - if endbits == -1 { break } // TODO: Check if this line is unnecessary } // Sort the lengths' array so finding of symbols will be more efficient self.lengths = newLengths.sorted() @@ -84,12 +80,6 @@ class HuffmanTable: CustomStringConvertible { self.lengths[index].symbol = symbol self.lengths[index].reversedSymbol = reverse(bits: loopBits, in: symbol) } - - // Finds minimum and maximum bits in the entire table of lengths - // TODO: Do we actually need this? - (self.minBits, self.maxBits) = self.lengths.reduce((16, -1)) { - return (min($0.0, $1.bits), max($0.1, $1.bits)) - } } convenience init(lengthsToOrder: [Int]) {