         }
         
         n = 0
-        
     }
     
     return a

    return bytesToType(sub_, T.self)
}

func unpack(var format:String, _ data:NSData) -> [AnyObject] {
    
    /*
    similar to unpack() in Python's struct module https://docs.python.org/2/library/struct.html but:
    - native sizes '@' are unsupported
    - so the first character is mandatory, must be '=', '<', '>' or '!'
    - native byte order '=' assumes a little-endian system (eg. Intel x86)
    - 'p' and 'P' format are unsupported
    - the format does not have to match with the exact quantity of data provided
    */
    
    assert(Int(OSHostByteOrder()) == OSLittleEndian, "\(__FILE__) assumes little endian, but host is big endian")
    
    if let firstChar = format.characters.first {
        let s : NSString = String(firstChar)
        let c = s.substringToIndex(1)
        let firstCharOptions = "=<>!"
        assert(firstCharOptions.containsString(c), "format '\(format)' first character must be among '\(firstCharOptions)'")
    }
    
    var isBigEndian = false
    
    var a : [AnyObject] = []
    
    var loc = 0

            let length = max(n,1)
            let sub = Array(bytes[loc..<loc+length])
            
            guard let s = NSString(bytes: sub, length: length, encoding: stringEncoding) else {
                assertionFailure("-- not a string: \(sub)")
                return []
            }
