_SignedIntegerType

protocol _SignedIntegerType

This protocol is an implementation detail of SignedIntegerType; do not use it directly.

Inheritance BitwiseOperationsType, Comparable, CustomStringConvertible, Equatable, Hashable, IntegerArithmeticType, IntegerLiteralConvertible, SignedNumberType, _Incrementable, _IntegerArithmeticType, _IntegerType View Protocol Hierarchy →
Associated Types
IntegerLiteralType
Import import Swift

Initializers

init(_:) Required

Convert from Swift's widest signed integer type, trapping on overflow.

Declaration

init(_: IntMax)
init(integerLiteral:) Required

Create an instance initialized to value.

Declaration

init(integerLiteral value: Self.IntegerLiteralType)

Declared In

IntegerLiteralConvertible

Static Variables

static var allZeros: Self Required

The empty bitset.

Also the identity element for | and ^, and the fixed point for &.

Declaration

static var allZeros: Self { get }

Declared In

BitwiseOperationsType

Instance Variables

var description: String Required

A textual representation of self.

Declaration

var description: String { get }

Declared In

CustomStringConvertible
var hashValue: Int Required

The hash value.

Axiom: x == y implies x.hashValue == y.hashValue.

Note: The hash value is not guaranteed to be stable across different invocations of the same program. Do not persist the hash value across program runs.

Declaration

var hashValue: Int { get }

Declared In

Hashable

Static Methods

static func addWithOverflow(_:_:) Required

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: Self, _ rhs: Self) -> (Self, overflow: Bool)

Declared In

_IntegerArithmeticType
static func divideWithOverflow(_:_:) Required

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: Self, _ rhs: Self) -> (Self, overflow: Bool)

Declared In

_IntegerArithmeticType
static func multiplyWithOverflow(_:_:) Required

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: Self, _ rhs: Self) -> (Self, overflow: Bool)

Declared In

_IntegerArithmeticType
static func remainderWithOverflow(_:_:) Required

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: Self, _ rhs: Self) -> (Self, overflow: Bool)

Declared In

_IntegerArithmeticType
static func subtractWithOverflow(_:_:) Required

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: Self, _ rhs: Self) -> (Self, overflow: Bool)

Declared In

_IntegerArithmeticType

Instance Methods

func %(_:rhs:) Required

Divide lhs and rhs, returning the remainder and trapping in case of arithmetic overflow (except in -Ounchecked builds).

Declaration

func %(lhs: Self, rhs: Self) -> Self

Declared In

IntegerArithmeticType
func &(_:rhs:) Required

Returns the intersection of bits set in lhs and rhs.

Complexity: O(1).

Declaration

func &(lhs: Self, rhs: Self) -> Self

Declared In

BitwiseOperationsType
func *(_:rhs:) Required

Multiply lhs and rhs, returning a result and trapping in case of arithmetic overflow (except in -Ounchecked builds).

Declaration

func *(lhs: Self, rhs: Self) -> Self

Declared In

IntegerArithmeticType
func +(_:rhs:) Required

Add lhs and rhs, returning a result and trapping in case of arithmetic overflow (except in -Ounchecked builds).

Declaration

func +(lhs: Self, rhs: Self) -> Self

Declared In

IntegerArithmeticType
func /(_:rhs:) Required

Divide lhs and rhs, returning a result and trapping in case of arithmetic overflow (except in -Ounchecked builds).

Declaration

func /(lhs: Self, rhs: Self) -> Self

Declared In

IntegerArithmeticType
func <(_:rhs:) Required

A strict total order over instances of Self.

Declaration

func <(lhs: Self, rhs: Self) -> Bool

Declared In

Comparable
func <=(_:rhs:)

Declaration

func <=(lhs: Self, rhs: Self) -> Bool

Declared In

Comparable
func ==(_:rhs:) Required

Return true if lhs is equal to rhs.

Equality implies substitutability. When x == y, x and y are interchangeable in any code that only depends on their values.

Class instance identity as distinguished by triple-equals === is notably not part of an instance's value. Exposing other non-value aspects of Equatable types is discouraged, and any that are exposed should be explicitly pointed out in documentation.

Equality is an equivalence relation

  • x == x is true
  • x == y implies y == x
  • x == y and y == z implies x == z

Inequality is the inverse of equality, i.e. !(x == y) iff x != y.

Declaration

func ==(lhs: Self, rhs: Self) -> Bool

Declared In

Equatable
func >(_:rhs:)

Declaration

func >(lhs: Self, rhs: Self) -> Bool

Declared In

Comparable
func >=(_:rhs:)

Declaration

func >=(lhs: Self, rhs: Self) -> Bool

Declared In

Comparable
func ^(_:rhs:) Required

Returns the bits that are set in exactly one of lhs and rhs.

Complexity: O(1).

Declaration

func ^(lhs: Self, rhs: Self) -> Self

Declared In

BitwiseOperationsType
func |(_:rhs:) Required

Returns the union of bits set in lhs and rhs.

Complexity: O(1).

Declaration

func |(lhs: Self, rhs: Self) -> Self

Declared In

BitwiseOperationsType
prefix func ~(_:) Required

Returns x ^ ~Self.allZeros.

Complexity: O(1).

Declaration

prefix func ~(x: Self) -> Self

Declared In

BitwiseOperationsType
prefix func -(_:) Required

Return the result of negating x.

Declaration

prefix func -(x: Self) -> Self

Declared In

SignedNumberType
func -(_:rhs:) Required

Subtract lhs and rhs, returning a result and trapping in case of arithmetic overflow (except in -Ounchecked builds).

Declaration

func -(lhs: Self, rhs: Self) -> Self

Declared In

IntegerArithmeticType, SignedNumberType
func successor() Required

Return the next consecutive value in a discrete sequence of Self values.

Requires: self has a well-defined successor.

Declaration

func successor() -> Self

Declared In

_Incrementable
func toIntMax() Required

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

Declaration

func toIntMax() -> IntMax

Declared In

_SignedIntegerType, IntegerArithmeticType