UInt64Extension.swift 618 B

1234567891011121314151617181920212223
  1. //
  2. // UInt64Extension.swift
  3. // CryptoSwift
  4. //
  5. // Created by Marcin Krzyzanowski on 02/09/14.
  6. // Copyright (c) 2014 Marcin Krzyzanowski. All rights reserved.
  7. //
  8. /** array of bytes */
  9. extension UInt64 {
  10. public func bytes(totalBytes: Int = sizeof(UInt64.self)) -> Array<UInt8> {
  11. return arrayOfBytes(value: self, length: totalBytes)
  12. }
  13. public static func with(bytes: ArraySlice<UInt8>) -> UInt64 {
  14. return integerWith(Array(bytes))
  15. }
  16. /** Int with array bytes (little-endian) */
  17. public static func with(bytes: Array<UInt8>) -> UInt64 {
  18. return integerWith(bytes)
  19. }
  20. }