Alignment

public struct Alignment : Comparable, Hashable

An alignment value, expressed in bytes.

  • Accesses the raw alignment value in bytes.

    Warning

    This accessor allows breaking out of the Alignment abstraction for raw alignment calculations. It is therefore not recommended that this accessor be used in user code.

    Declaration

    Swift

    public let rawValue: UInt32
  • A zero-byte alignment value.

    Declaration

    Swift

    public static let zero: Alignment
  • one

    An one-byte alignment value.

    Declaration

    Swift

    public static let one: Alignment
  • Initializes and returns an alignment with the given value interpreted as a quantity of bytes.

    Declaration

    Swift

    public init(_ value: UInt32)
  • Returns true if this alignment value is zero bytes, else return false.

    Declaration

    Swift

    public var isZero: Bool { get }
  • Returns the log-base-two value of this alignment as a 32-bit integer.

    An n-byte alignment contains log-base-two-many least-significant zeros.

    Declaration

    Swift

    public func log2() -> UInt32
  • Returns the log-base-two value of this alignment as a 64-bit integer.

    An n-byte alignment contains log-base-two-many least-significant zeros.

    Declaration

    Swift

    public func log2() -> UInt64
  • Returns the alignment of a pointer which points to the given number of bytes after a pointer with this alignment.

    Declaration

    Swift

    public func alignment(at offset: Size) -> Alignment
  • Declaration

    Swift

    public static func == (lhs: Alignment, rhs: Alignment) -> Bool
  • Declaration

    Swift

    public static func < (lhs: Alignment, rhs: Alignment) -> Bool
  • Declaration

    Swift

    public func hash(into hasher: inout Hasher)