struct
Int8
Inheritance |
BidirectionalIndexType, BitwiseOperationsType, CVarArgType, Comparable, Equatable, ForwardIndexType, Hashable, IntegerArithmeticType, IntegerLiteralConvertible, IntegerType, Printable, RandomAccessIndexType, Reflectable, SignedIntegerType, SignedNumberType, Strideable, _BidirectionalIndexType, _Comparable, _ForwardIndexType, _Incrementable, _IntegerArithmeticType, _IntegerType, _RandomAccessIndexType, _SignedIntegerType, _SignedNumberType, _Strideable
View Protocol Hierarchy →
|
---|---|
Associated Types |
A type that can represent the number of steps between pairs of values. |
Import |
|
Initializers
Create an instance initialized to zero.
Declaration
init
()
Declaration
init
(
_
v
:
Int
)
Declaration
init
(
_
v
:
Int16
)
Declaration
init
(
_
v
:
Int32
)
Declaration
init
(
_
v
:
Int64
)
Declaration
init
(
_
v
:
UInt
)
Declaration
init
(
_
v
:
UInt8
)
Declaration
init
(
_
v
:
UInt16
)
Declaration
init
(
_
v
:
UInt32
)
Declaration
init
(
_
v
:
UInt64
)
Declaration
init
(
_builtinIntegerLiteral
value
:
Builtin
.
Int2048
)
Construct a Int8
having the same memory representation as
the UInt8
bitPattern
. No range or overflow checking
occurs, and the resulting Int8
may not have the same numeric
value as bitPattern
--it is only guaranteed to use the same
pattern of bits.
Declaration
init
(
bitPattern
:
UInt8
)
Construct a Int8
having the same bitwise representation as
the least significant bits of the provided bit pattern.
No range or overflow checking occurs.
Declaration
init
(
truncatingBitPattern
:
Int
)
Construct a Int8
having the same bitwise representation as
the least significant bits of the provided bit pattern.
No range or overflow checking occurs.
Declaration
init
(
truncatingBitPattern
:
Int16
)
Construct a Int8
having the same bitwise representation as
the least significant bits of the provided bit pattern.
No range or overflow checking occurs.
Declaration
init
(
truncatingBitPattern
:
Int32
)
Construct a Int8
having the same bitwise representation as
the least significant bits of the provided bit pattern.
No range or overflow checking occurs.
Declaration
init
(
truncatingBitPattern
:
Int64
)
Construct a Int8
having the same bitwise representation as
the least significant bits of the provided bit pattern.
No range or overflow checking occurs.
Declaration
init
(
truncatingBitPattern
:
UInt
)
Construct a Int8
having the same bitwise representation as
the least significant bits of the provided bit pattern.
No range or overflow checking occurs.
Declaration
init
(
truncatingBitPattern
:
UInt16
)
Construct a Int8
having the same bitwise representation as
the least significant bits of the provided bit pattern.
No range or overflow checking occurs.
Declaration
init
(
truncatingBitPattern
:
UInt32
)
Construct a Int8
having the same bitwise representation as
the least significant bits of the provided bit pattern.
No range or overflow checking occurs.
Declaration
init
(
truncatingBitPattern
:
UInt64
)
Static Variables
Declaration
static
var
max
:
Int8
{
get
}
Declaration
static
var
min
:
Int8
{
get
}
Instance Variables
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
}
Declaration
var
value
:
Builtin
.
Int8
{
get
set
}
Static Methods
Instance Methods
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
(
amount
:
Distance
) -
>
Int8
Return the minimum number of applications of successor
or
predecessor
required to reach other
from self
.
Complexity: O(1).
Declaration
func
distanceTo
(
other
:
Int8
) -
>
Distance
Transform self
into a series of machine words that can be
appropriately interpreted by C varargs
Declaration
func
encode
() -
>
[
Word
]
Returns the previous consecutive value before self
.
Requires: the previous value is representable.
Declaration
func
predecessor
() -
>
Int8
Returns the next consecutive value after self
.
Requires: the next value is representable.
Declaration
func
successor
() -
>
Int8
Represent this number using Swift's widest native signed integer type.
Declaration
func
toIntMax
() -
>
IntMax
A 8-bit signed integer value type.