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 moreUnsignedIntegerto store the allocated entries allowing upto.bitWidthentries to be allocated.Declaration
Swift
public struct BitmapAllocator<BitmapType: FixedWidthInteger & UnsignedInteger>: BitmapAllocatorProtocol, CustomStringConvertible -
An allocator that uses 2
See moreUnsignedIntegers to store the allocated entries allowing upto 2x.bitWidthentries 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 : UnsignedIntegerextension ByteArray: Sequenceextension ByteArray: MutableCollectionextension ByteArray: BidirectionalCollectionextension ByteArray: RandomAccessCollectionextension ByteArray: RangeReplaceableCollectionextension ByteArray: Equatableextension ByteArray: CustomStringConvertibleextension ByteArray: CustomDebugStringConvertible -
Undocumented
See moreDeclaration
Swift
public struct ByteArrayIterator<T> : IteratorProtocol where T : FixedWidthInteger, T : UnsignedInteger -
NumberSetuses a specified unsignedFixedWidthIntegeras the storage for a Set containing the numbers 0…bitWidth. eg aUInt8can contain the numbers0...7, aUInt64can 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. TherawValueproperty 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 : UnsignedIntegerextension NumberSet: Sequenceextension NumberSet: CustomStringConvertible
View on GitHub
Structures Reference