Int64

struct Int64

A 64-bit signed integer value type.

Inheritance BidirectionalIndexType, BitwiseOperationsType, CVarArgType, Comparable, CustomStringConvertible, Equatable, ForwardIndexType, Hashable, IntegerArithmeticType, IntegerLiteralConvertible, IntegerType, RandomAccessIndexType, SignedIntegerType, SignedNumberType, Strideable, _CVarArgAlignedType, _Incrementable, _IntegerArithmeticType, _IntegerType, _RandomAccessAmbiguity, _Reflectable, _SignedIntegerType View Protocol Hierarchy →
Associated Types
Distance = Int

A type that can represent the number of steps between pairs of values.

Import import Swift

Initializers

init()

Create an instance initialized to zero.

Declaration

init()
init(_: Double)

Construct an instance that approximates other.

Declaration

init(_ other: Double)
init(_: Float)

Construct an instance that approximates other.

Declaration

init(_ other: Float)
init(_: Float80)

Construct an instance that approximates other.

Declaration

init(_ other: Float80)
init(_: Int)

Declaration

init(_ v: Int)
init(_: Int8)

Declaration

init(_ v: Int8)
init(_: Int16)

Declaration

init(_ v: Int16)
init(_: Int32)

Declaration

init(_ v: Int32)
init(_: Int64)

Create an instance initialized to value.

Declaration

init(_ value: Int64)
init(_: UInt)

Declaration

init(_ v: UInt)
init(_: UInt8)

Declaration

init(_ v: UInt8)
init(_: UInt16)

Declaration

init(_ v: UInt16)
init(_: UInt32)

Declaration

init(_ v: UInt32)
init(_: UInt64)

Declaration

init(_ v: UInt64)
init(_builtinIntegerLiteral:)

Declaration

init(_builtinIntegerLiteral value: Builtin.Int2048)
init(bigEndian:)

Creates an integer from its big-endian representation, changing the byte order if necessary.

Declaration

init(bigEndian value: Int64)
init(bitPattern:)

Construct a Int64 having the same memory representation as the UInt64 bitPattern. No range or overflow checking occurs, and the resulting Int64 may not have the same numeric value as bitPattern--it is only guaranteed to use the same pattern of bits.

Declaration

init(bitPattern: UInt64)
init(integerLiteral:)

Create an instance initialized to value.

Declaration

init(integerLiteral value: Int64)
init(littleEndian:)

Creates an integer from its little-endian representation, changing the byte order if necessary.

Declaration

init(littleEndian value: Int64)
init?(_:radix:)

Construct from an ASCII representation in the given radix.

If text does not match the regular expression "[+-]?[0-9a-zA-Z]+", or the value it denotes in the given radix is not representable, the result is nil.

Declaration

init?(_ text: String, radix: Int = default)

Static Variables

static var allZeros: Int64

The empty bitset of type Int64.

Declaration

static var allZeros: Int64 { get }
static var max: Int64

Declaration

static var max: Int64 { get }
static var min: Int64

Declaration

static var min: Int64 { get }

Instance Variables

var bigEndian: Int64

Returns the big-endian representation of the integer, changing the byte order if necessary.

Declaration

var bigEndian: Int64 { get }
var byteSwapped: Int64

Returns the current integer with the byte order swapped.

Declaration

var byteSwapped: Int64 { get }
var description: String

A textual representation of self.

Declaration

var description: String { get }
var hashValue: Int

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 }
var littleEndian: Int64

Returns the little-endian representation of the integer, changing the byte order if necessary.

Declaration

var littleEndian: Int64 { get }

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

Instance Methods

func advancedBy(_:)

Declaration

func advancedBy(n: Distance) -> Int64

Declared In

Int64, BidirectionalIndexType, _RandomAccessAmbiguity, ForwardIndexType
func advancedBy(_:limit:)

Declaration

func advancedBy(n: Int64.Distance, limit: Int64) -> Int64

Declared In

RandomAccessIndexType, BidirectionalIndexType, ForwardIndexType
func distanceTo(_:)

Declaration

func distanceTo(other: Int64) -> Distance

Declared In

Int64, BidirectionalIndexType, ForwardIndexType
func predecessor()

Returns the previous consecutive value before self.

Requires: The previous value is representable.

Declaration

func predecessor() -> Int64
func stride(through:by:)

Returns the sequence of values (self, self + stride, self + stride + stride, ... last) where last is the last value in the progression less than or equal to end.

Note: There is no guarantee that end is an element of the sequence.

Declaration

func stride(through end: Int64, by stride: Int64.Stride) -> StrideThrough<Int64>

Declared In

Strideable
func stride(to:by:)

Returns the sequence of values (self, self + stride, self + stride + stride, ... last) where last is the last value in the progression that is less than end.

Declaration

func stride(to end: Int64, by stride: Int64.Stride) -> StrideTo<Int64>

Declared In

Strideable
func successor()

Returns the next consecutive value after self.

Requires: The next value is representable.

Declaration

func successor() -> Int64
func toIntMax()

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

Declaration

func toIntMax() -> IntMax