findNextSymbol now uses new tree array.

This commit is contained in:
Timofey Solomko
2017-02-25 15:04:52 +03:00
parent c03f1943fb
commit aee09c93ec
+7 -2
View File
@@ -117,8 +117,13 @@ class HuffmanTree {
let bit = pointerData.bit()
index = bit == 0 ? 2 * index + 1 : 2 * index + 2
guard index < self.leafCount else { return -1 }
if self.tree[index][0] > -1 {
return self.tree[index][0]
switch self.newTree[index] {
case .leaf(let symbol):
if symbol > -1 {
return symbol
}
default:
continue
}
}
}