瀏覽代碼

fix arrayOfBytes regarding output size

Marcin Krzyżanowski 10 年之前
父節點
當前提交
a553a2b707
共有 1 個文件被更改,包括 1 次插入1 次删除
  1. 1 1
      CryptoSwift/Generics.swift

+ 1 - 1
CryptoSwift/Generics.swift

@@ -55,7 +55,7 @@ func integerWithBytes<T: IntegerType>(bytes: [UInt8]) -> T {
 
 /** array of bytes, little-endian representation */
 func arrayOfBytes<T>(value:T, length:Int? = nil) -> [UInt8] {
-    let totalBytes = length ?? (sizeofValue(value) * 8)
+    let totalBytes = length ?? sizeof(T)
     var v = value
     
     var valuePointer = UnsafeMutablePointer<T>.alloc(1)