struct
UInt16
Initializers
Create an instance initialized to zero.
Declaration
init
()
Creates a new instance by rounding the given floating-point value toward zero.
other
: A floating-point value. When other
is rounded toward
zero, the result must be within the range UInt16.min...UInt16.max
.
Declaration
init
(
_
value
:
Double
)
Creates a new instance by rounding the given floating-point value toward zero.
other
: A floating-point value. When other
is rounded toward
zero, the result must be within the range UInt16.min...UInt16.max
.
Declaration
init
(
_
value
:
Float
)
Creates a new instance by rounding the given floating-point value toward zero.
other
: A floating-point value. When other
is rounded toward
zero, the result must be within the range UInt16.min...UInt16.max
.
Declaration
init
(
_
value
:
Float80
)
Declaration
init
(
_
value
:
Int
)
Declaration
init
(
_
value
:
Int8
)
Declaration
init
(
_
value
:
Int16
)
Declaration
init
(
_
value
:
Int32
)
Declaration
init
(
_
value
:
Int64
)
Declaration
init
(
_
value
:
UInt
)
Declaration
init
(
_
value
:
UInt8
)
Declaration
init
(
_
value
:
UInt16
)
Declaration
init
(
_
value
:
UInt32
)
Convert from Swift's widest unsigned integer type, trapping on overflow.
Declaration
init
(
_
value
:
UInt64
)
Creates an integer from its big-endian representation, changing the byte order if necessary.
Declaration
init
(
bigEndian
value
:
UInt16
)
Construct a UInt16
having the same memory representation as
the Int16
bitPattern
. No range or overflow checking
occurs, and the resulting UInt16
may not have the same numeric
value as bitPattern
--it is only guaranteed to use the same
pattern of bits.
Declaration
init
(
bitPattern
:
Int16
)
Create an instance initialized to value
.
Declaration
init
(
integerLiteral
value
:
UInt16
)
Declared In
UInt16
, Integer
, ExpressibleByIntegerLiteral
Creates an integer from its little-endian representation, changing the byte order if necessary.
Declaration
init
(
littleEndian
value
:
UInt16
)
Construct a UInt16
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 UInt16
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 UInt16
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 UInt16
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 UInt16
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 UInt16
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
)
Creates a UInt16 whose value is value
if no rounding is necessary, nil otherwise.
Declaration
init
?(
exactly
value
:
Double
)
Creates a UInt16 whose value is value
if no rounding is necessary, nil otherwise.
Declaration
init
?(
exactly
value
:
Float
)
Creates a UInt16 whose value is value
if no rounding is necessary, nil otherwise.
Declaration
init
?(
exactly
value
:
Float80
)
Declaration
init
?(
exactly
value
:
Int
)
Declaration
init
?(
exactly
value
:
Int8
)
Declaration
init
?(
exactly
value
:
Int16
)
Declaration
init
?(
exactly
value
:
Int32
)
Declaration
init
?(
exactly
value
:
Int64
)
Declaration
init
?(
exactly
value
:
UInt
)
Declaration
init
?(
exactly
value
:
UInt8
)
Declaration
init
?(
exactly
value
:
UInt16
)
Declaration
init
?(
exactly
value
:
UInt32
)
Declaration
init
?(
exactly
value
:
UInt64
)
Static Variables
Declaration
static
var
max
:
UInt16
{
get
}
Declaration
static
var
min
:
UInt16
{
get
}
Instance Variables
Returns the big-endian representation of the integer, changing the byte order if necessary.
Declaration
var
bigEndian
:
UInt16
{
get
}
Returns the current integer with the byte order swapped.
Declaration
var
byteSwapped
:
UInt16
{
get
}
A custom playground Quick Look for this instance.
If this type has value semantics, the PlaygroundQuickLook
instance
should be unaffected by subsequent mutations.
Declaration
var
customPlaygroundQuickLook
:
PlaygroundQuickLook
{
get
}
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
}
Returns the little-endian representation of the integer, changing the byte order if necessary.
Declaration
var
littleEndian
:
UInt16
{
get
}
Static Methods
Instance Methods
Returns a Self
x
such that self.distance(to: x)
approximates n
.
If Stride
conforms to Integer
, then self.distance(to: x) == n
.
Complexity: O(1).
Declaration
Declared In
UnsignedInteger
Returns a stride x
such that self.advanced(by: x)
approximates
other
.
If Stride
conforms to Integer
, then self.advanced(by: x) == other
.
Complexity: O(1).
Declaration
Declared In
UnsignedInteger
Represent this number using Swift's widest native unsigned integer type.
Declaration
func
toUIntMax
() -
>
UIntMax
2 inherited items hidden. (Show all)
A 16-bit unsigned integer value type.