swift-mmio
swift-mmio copied to clipboard
It would be useful to have common bit sizes of unsigned integers for BitFieldProjectables
UInt8
, UInt16
, UInt32
, and UInt64
are common field member types (when not enumerations or option sets).
extension UInt8: BitFieldProjectable {
public static var bitWidth: Int { 8 }
public init<Storage>(storage: Storage)
where Storage: FixedWidthInteger & UnsignedInteger {
self.init(storage)
}
public func storage<Storage>(_: Storage.Type) -> Storage
where Storage: FixedWidthInteger & UnsignedInteger {
Storage(self)
}
}