我需要在Objective-C中重寫一些Python腳本。這並不難,因爲Python易於閱讀,但是這段代碼讓我苦苦掙扎。str_to_a32 - 這個函數做什麼?
def str_to_a32(b):
if len(b) % 4:
# pad to multiple of 4
b += '\0' * (4 - len(b) % 4)
return struct.unpack('>%dI' % (len(b)/4), b)
這個函數應該做什麼?
他說什麼:) – theodox
「a32」代表什麼? – wczekalski
@Wojtek'32'可能指的是整數的大小(32位== 4字節)。 'a'可能只是說你會得到「32」,或者它可能意味着你正在使用的代碼中的其他內容。 – thegrinner