Bit

enum Bit

A RandomAccessIndexType that has two possible values. Used as the Index type for SequenceOfOne<T>.

Inheritance BidirectionalIndexType, Comparable, Equatable, ForwardIndexType, Int, IntegerArithmeticType, RandomAccessIndexType, Reflectable, Strideable, _BidirectionalIndexType, _Comparable, _ForwardIndexType, _Incrementable, _IntegerArithmeticType, _RandomAccessIndexType, _Strideable View Protocol Hierarchy →
Import import Swift

Cases

Static Methods

static func addWithOverflow(_:_:)

Add lhs and rhs, returning a result and a Bool that is true iff the operation caused an arithmetic overflow.

Declaration

static func addWithOverflow(lhs: Bit, _ rhs: Bit) -> (Bit, overflow: Bool)
static func divideWithOverflow(_:_:)

Divide lhs and rhs, returning a result and a Bool that is true iff the operation caused an arithmetic overflow.

Declaration

static func divideWithOverflow(lhs: Bit, _ rhs: Bit) -> (Bit, overflow: Bool)
static func multiplyWithOverflow(_:_:)

Multiply lhs and rhs, returning a result and a Bool that is true iff the operation caused an arithmetic overflow.

Declaration

static func multiplyWithOverflow(lhs: Bit, _ rhs: Bit) -> (Bit, overflow: Bool)
static func remainderWithOverflow(_:_:)

Divide lhs and rhs, returning the remainder and a Bool that is true iff the operation caused an arithmetic overflow.

Declaration

static func remainderWithOverflow(lhs: Bit, _ rhs: Bit) -> (Bit, overflow: Bool)
static func subtractWithOverflow(_:_:)

Subtract lhs and rhs, returning a result and a Bool that is true iff the operation caused an arithmetic overflow.

Declaration

static func subtractWithOverflow(lhs: Bit, _ rhs: Bit) -> (Bit, overflow: Bool)

Instance Methods

func advancedBy(_:)

Return self offset by n steps.

Returns: If n > 0, the result of applying successor to self n times. If n < 0, the result of applying predecessor to self -n times. Otherwise, self.

Complexity: O(1)

Declaration

func advancedBy(distance: Int) -> Bit
func distanceTo(_:)

Return the minimum number of applications of successor or predecessor required to reach other from self.

Complexity: O(1).

Declaration

func distanceTo(other: Bit) -> Int
func getMirror()

Returns a mirror that reflects self.

Declaration

func getMirror() -> MirrorType
func predecessor()

Returns the previous consecutive value before self.

Requires: self != .Zero.

Declaration

func predecessor() -> Bit
func successor()

Returns the next consecutive value after self.

Requires: self == .Zero.

Declaration

func successor() -> Bit
func toIntMax()

Represent this number using Swift's widest native signed integer type.

Declaration

func toIntMax() -> IntMax