소스 검색

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)