Structures
The following structures are available globally.
-
A type that uses a fixed width, unsigned integer as storage for an array of bits. The number of bits is fixed and by default are set to zero.
See moreUsing fixed width arrays of bits can be used to implement bitfield like data structures. As an example, consider an 8-bit value that represents the following data +---------+---------+-------+-------+ | b7:4 | b2:3 | b1 | b0 | | Value 2 | Value 1 | Flag2 | Flag1 | +---------+---------+-------+-------+ struct Data { private var bits: BitField8 var flag1: Bool { get { bits[0] } set { bits[0] = newValue } var flag2: Bool { bits[1] } var value1: Int { bits[2...3] } var value2: Int { get { bits[4...7] } set { buts[4...7] = newValue } } }
Declaration
Swift
public struct BitField<T: FixedWidthInteger & UnsignedInteger>: RandomAccessCollection, MutableCollection, CustomStringConvertible
-
An allocator that uses an
See moreUnsignedInteger
to store the allocated entries allowing upto.bitWidth
entries to be allocated.Declaration
Swift
public struct BitmapAllocator<BitmapType: FixedWidthInteger & UnsignedInteger>: BitmapAllocatorProtocol, CustomStringConvertible
-
An allocator that uses 2
See moreUnsignedInteger
s to store the allocated entries allowing upto 2x.bitWidth
entries to be allocated.Declaration
Swift
public struct DoubleBitmapAllocator<BitmapType: FixedWidthInteger & UnsignedInteger>: BitmapAllocatorProtocol, CustomStringConvertible
-
Undocumented
See moreDeclaration
Swift
public struct ByteArray<T> where T : FixedWidthInteger, T : UnsignedInteger
extension ByteArray: Sequence
extension ByteArray: MutableCollection
extension ByteArray: BidirectionalCollection
extension ByteArray: RandomAccessCollection
extension ByteArray: RangeReplaceableCollection
extension ByteArray: Equatable
extension ByteArray: CustomStringConvertible
extension ByteArray: CustomDebugStringConvertible
-
Undocumented
See moreDeclaration
Swift
public struct ByteArrayIterator<T> : IteratorProtocol where T : FixedWidthInteger, T : UnsignedInteger
-
NumberSet
uses a specified unsignedFixedWidthInteger
as the storage for a Set containing the numbers 0…bitWidth
. eg aUInt8
can contain the numbers0...7
, aUInt64
can store0...63
. The storage uses a bit per number where bit[x
] is used to storex
. This gives an ordering of the set from lowest to highest. TherawValue
property represents the underlying storage and can be easily interpreted.
See morerawValue = 0b1001_0001 [0, 4, 7]
Declaration
Swift
public struct NumberSet<T> : SetAlgebra where T : FixedWidthInteger, T : UnsignedInteger
extension NumberSet: Sequence
extension NumberSet: CustomStringConvertible