| 12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- //
- // IntegerConvertible.swift
- // CryptoSwift
- //
- // Created by Marcin Krzyzanowski on 02/06/15.
- // Copyright (c) 2015 Marcin Krzyzanowski. All rights reserved.
- //
- protocol BitshiftOperationsType {
- static func <<(lhs: Self, rhs: Self) -> Self
- static func >>(lhs: Self, rhs: Self) -> Self
- static func <<=(lhs: inout Self, rhs: Self)
- static func >>=(lhs: inout Self, rhs: Self)
- }
- protocol ByteConvertible {
- init(_ value: UInt8)
- init(truncatingBitPattern: UInt64)
- }
- extension Int: BitshiftOperationsType, ByteConvertible {}
- extension Int8: BitshiftOperationsType, ByteConvertible {}
- extension Int16: BitshiftOperationsType, ByteConvertible {}
- extension Int32: BitshiftOperationsType, ByteConvertible {}
- extension Int64: BitshiftOperationsType, ByteConvertible {
- init(truncatingBitPattern value: UInt64) {
- self = Int64(bitPattern: value)
- }
- }
- extension UInt: BitshiftOperationsType, ByteConvertible {}
- extension UInt8: BitshiftOperationsType, ByteConvertible {}
- extension UInt16: BitshiftOperationsType, ByteConvertible {}
- extension UInt32: BitshiftOperationsType, ByteConvertible {}
- extension UInt64: BitshiftOperationsType, ByteConvertible {
- init(truncatingBitPattern value: UInt64) {
- self = value
- }
- }
|