     }
 
 }
+

        // Add 'end of stream' symbol.
        symbolOut.append(maxSymbol + 1)

        // Huffman Coding
        let bitWriter = BitWriter(bitOrder: .straight)

        // First, we analyze data and create Huffman trees and selectors.
        // Then we will perform encoding itself.
        // These are separate stages because all information about trees is stored at the beginning of the block,

                        minimumSelector = tableIndex
                    }
                }
                if table.bitSize(for: stats) < minimumSize && tables.count < 6 {
                    tables.append(table)
                    tablesLengths.append(lengths.sorted { $0.symbol < $1.symbol }.map { $0.codeLength })
                    selectorList.append(tables.count - 1)
