 
         func reverse(bits: Int, in symbol: Int) -> Int {
             // Auxiliarly subfunction, which computes reversed order of bits in a number
-            // This is some weird magic
             var a = 1 << 0
             var b = 1 << (bits - 1)
             var z = 0

        }

        // Calculates symbol and reversedSymbol properties for each length in 'lengths' array
        // This is done with the help of some weird magic
        var loopBits = -1
        var symbol = -1
        for index in 0..<self.lengths.count {
            symbol += 1
            let length = self.lengths[index]
            if length.bits != loopBits {
                symbol <<= (length.bits - loopBits)
                loopBits = length.bits

//

import Foundation

class HuffmanTable: CustomStringConvertible {

