struct
UInt8
Inheritance |
BidirectionalIndexType, BitwiseOperationsType, CVarArgType, Comparable, CustomStringConvertible, Equatable, ForwardIndexType, Hashable, IntegerArithmeticType, IntegerLiteralConvertible, IntegerType, RandomAccessIndexType, Strideable, UnsignedIntegerType, _DisallowMixedSignArithmetic, _Incrementable, _IntegerArithmeticType, _IntegerType, _RandomAccessAmbiguity, _Reflectable
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
:
Int8
)
Declaration
init
(
_
v
:
Int16
)
Declaration
init
(
_
v
:
Int32
)
Declaration
init
(
_
v
:
Int64
)
Declaration
init
(
_
v
:
UInt
)
Declaration
init
(
_
v
:
UInt16
)
Declaration
init
(
_
v
:
UInt32
)
Declaration
init
(
_
v
:
UInt64
)
Declaration
init
(
_builtinIntegerLiteral
value
:
Builtin
.
Int2048
)
Construct with value v.value
.
Requires: v.value
can be represented as ASCII (0..<128).
Declaration
init
(
ascii
v
:
UnicodeScalar
)
Construct a UInt8
having the same memory representation as
the Int8
bitPattern
. No range or overflow checking
occurs, and the resulting UInt8
may not have the same numeric
value as bitPattern
--it is only guaranteed to use the same
pattern of bits.
Declaration
init
(
bitPattern
:
Int8
)
Construct a UInt8
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 UInt8
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 UInt8
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 UInt8
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 UInt8
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 UInt8
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 UInt8
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 UInt8
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
:
UInt8
{
get
}
Declaration
static
var
min
:
UInt8
{
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
}
Static Methods
Instance Methods
Declaration
func
advancedBy
(
n
:
Distance
) -
>
UInt8
Declared In
UInt8
, IntegerType
, RandomAccessIndexType
, BidirectionalIndexType
, _RandomAccessAmbiguity
, ForwardIndexType
Returns the result of advancing self
by n
positions, or until it
equals limit
.
Returns:
- If n > 0
, the result of applying successor
to self
n
times
but not past limit
.
- If n < 0
, the result of applying predecessor
to self
-n
times
but not past limit
.
- Otherwise, self
.
Requires: n >= 0
if only conforming to ForwardIndexType
.
Complexity:
- O(1) if conforming to RandomAccessIndexType
- O(abs(n)
) otherwise
Declaration
Declared In
IntegerType
, RandomAccessIndexType
, BidirectionalIndexType
, ForwardIndexType
Declaration
func
distanceTo
(
other
:
UInt8
) -
>
Distance
Declared In
UInt8
, IntegerType
, RandomAccessIndexType
, BidirectionalIndexType
, ForwardIndexType
Returns the previous consecutive value before self
.
Requires: The previous value is representable.
Declaration
func
predecessor
() -
>
UInt8
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
:
UInt8
,
by
stride
:
UInt8
.
Stride
) -
>
StrideThrough
<
UInt8
>
Declared In
IntegerType
, RandomAccessIndexType
, Strideable
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
Declared In
IntegerType
, RandomAccessIndexType
, Strideable
Returns the next consecutive value after self
.
Requires: The next value is representable.
Declaration
func
successor
() -
>
UInt8
Represent this number using Swift's widest native unsigned integer type.
Declaration
func
toUIntMax
() -
>
UIntMax
3 inherited items hidden. (Show all)
An 8-bit unsigned integer value type.