Explorar o código

fix arrayOfBytes regarding output size

Marcin Krzyżanowski %!s(int64=10) %!d(string=hai) anos
pai
achega
a553a2b707
Modificáronse 1 ficheiros con 1 adicións e 1 borrados
  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)