StructureSwift5.9.0
Int16
A 16-bit signed integer value type.
@frozen struct Int16
Citizens in Swift
Conformances
protocol AdditiveArithmetic
A type with values that support addition and subtraction.
protocol BinaryInteger
An integer type with a binary representation.
protocol CVarArg
A type whose instances can be encoded, and appropriately passed, as elements of a C
va_list
.protocol Comparable
A type that can be compared using the relational operators
<
,<=
,>=
, and>
.protocol CustomReflectable
A type that explicitly supplies its own mirror.
protocol CustomStringConvertible
A type with a customized textual representation.
protocol Decodable
A type that can decode itself from an external representation.
protocol Encodable
A type that can encode itself to an external representation.
protocol Equatable
A type that can be compared for value equality.
protocol ExpressibleByIntegerLiteral
A type that can be initialized with an integer literal.
protocol FixedWidthInteger
An integer type that uses a fixed size for every instance.
protocol Hashable
A type that can be hashed into a
Hasher
to produce an integer hash value.protocol LosslessStringConvertible
A type that can be represented as a string in a lossless, unambiguous way.
protocol Numeric
A type with values that support multiplication.
protocol SIMDScalar
A type that can be used as an element in a SIMD vector.
protocol Sendable
A type whose values can safely be passed across concurrency domains by copying.
protocol SignedInteger
An integer type that can represent both positive and negative values.
protocol SignedNumeric
A numeric type with a negation operation.
protocol Strideable
A type representing continuous, one-dimensional values that can be offset and measured.
Members
init(Double
) Creates an integer from the given floating-point value, rounding toward zero.
init(Float
) Creates an integer from the given floating-point value, rounding toward zero.
init(Float16
) Creates an integer from the given floating-point value, rounding toward zero.
init(Float80
) Creates an integer from the given floating-point value, rounding toward zero.
init(bitPattern: UInt16
) Creates a new instance with the same memory representation as the given value.
init?(exactly: Double
) Creates an integer from the given floating-point value, if it can be represented exactly.
init?(exactly: Float
) Creates an integer from the given floating-point value, if it can be represented exactly.
init?(exactly: Float16
) Creates an integer from the given floating-point value, if it can be represented exactly.
init?(exactly: Float80
) Creates an integer from the given floating-point value, if it can be represented exactly.
init(from: Decoder
) throws Creates a new instance by decoding from the given decoder.
static var bitWidth: Int
The number of bits used for the underlying binary representation of values of this type.
var byteSwapped: Int16
A representation of this integer with the byte order swapped.
var customMirror: Mirror
A mirror that reflects the
Int16
instance.var leadingZeroBitCount: Int
The number of leading zeros in this value’s binary representation.
var magnitude: UInt16
The magnitude of this value.
var nonzeroBitCount: Int
The number of bits equal to 1 in this value’s binary representation.
var trailingZeroBitCount: Int
The number of trailing zeros in this value’s binary representation.
var words: Int16.Words
A collection containing the words of this value’s binary representation, in order from the least significant to most significant.
static func % (Int16, Int16
) -> Int16 Returns the remainder of dividing the first value by the second.
static func %= (inout Int16, Int16
) Divides the first value by the second and stores the remainder in the left-hand-side variable.
static func & (Int16, Int16
) -> Int16 Returns the result of performing a bitwise AND operation on the two given values.
static func &<< (Int16, Int16
) -> Int16 Returns the result of shifting a value’s binary representation the specified number of digits to the left, masking the shift amount to the type’s bit width.
static func &<<= (inout Int16, Int16
) Returns the result of shifting a value’s binary representation the specified number of digits to the left, masking the shift amount to the type’s bit width, and stores the result in the left-hand-side variable.
static func &= (inout Int16, Int16
) Stores the result of performing a bitwise AND operation on the two given values in the left-hand-side variable.
static func &>> (Int16, Int16
) -> Int16 Returns the result of shifting a value’s binary representation the specified number of digits to the right, masking the shift amount to the type’s bit width.
static func &>>= (inout Int16, Int16
) Calculates the result of shifting a value’s binary representation the specified number of digits to the right, masking the shift amount to the type’s bit width, and stores the result in the left-hand-side variable.
static func * (Int16, Int16
) -> Int16 Multiplies two values and produces their product.
static func *= (inout Int16, Int16
) Multiplies two values and stores the result in the left-hand-side variable.
static func + (Int16, Int16
) -> Int16 Adds two values and produces their sum.
static func += (inout Int16, Int16
) Adds two values and stores the result in the left-hand-side variable.
static func - (Int16, Int16
) -> Int16 Subtracts one value from another and produces their difference.
static func -= (inout Int16, Int16
) Subtracts the second value from the first and stores the difference in the left-hand-side variable.
static func / (Int16, Int16
) -> Int16 Returns the quotient of dividing the first value by the second.
static func /= (inout Int16, Int16
) Divides the first value by the second and stores the quotient in the left-hand-side variable.
static func < (Int16, Int16
) -> Bool static func <= (Int16, Int16
) -> Bool static func == (Int16, Int16
) -> Bool static func > (Int16, Int16
) -> Bool static func >= (Int16, Int16
) -> Bool static func ^ (Int16, Int16
) -> Int16 Returns the result of performing a bitwise XOR operation on the two given values.
static func ^= (inout Int16, Int16
) Stores the result of performing a bitwise XOR operation on the two given values in the left-hand-side variable.
static func | (Int16, Int16
) -> Int16 Returns the result of performing a bitwise OR operation on the two given values.
static func |= (inout Int16, Int16
) Stores the result of performing a bitwise OR operation on the two given values in the left-hand-side variable.
func addingReportingOverflow(Int16
) -> (partialValue: Int16, overflow: Bool) Returns the sum of this value and the given value, along with a Boolean value indicating whether overflow occurred in the operation.
func dividedReportingOverflow(by: Int16
) -> (partialValue: Int16, overflow: Bool) Returns the quotient obtained by dividing this value by the given value, along with a Boolean value indicating whether overflow occurred in the operation.
func dividingFullWidth((high: Int16, low: Int16.Magnitude)
) -> (quotient: Int16, remainder: Int16) Returns a tuple containing the quotient and remainder of dividing the given value by this value.
func encode(to: Encoder
) throws Encodes this value into the given encoder.
func hash(into: inout Hasher
) Hashes the essential components of this value by feeding them into the given hasher.
func multipliedFullWidth(by: Int16
) -> (high: Int16, low: Int16.Magnitude) Returns a tuple containing the high and low parts of the result of multiplying this value by the given value.
func multipliedReportingOverflow(by: Int16
) -> (partialValue: Int16, overflow: Bool) Returns the product of this value and the given value, along with a Boolean value indicating whether overflow occurred in the operation.
func remainderReportingOverflow(dividingBy: Int16
) -> (partialValue: Int16, overflow: Bool) Returns the remainder after dividing this value by the given value, along with a Boolean value indicating whether overflow occurred during division.
func signum(
) -> Int16 Returns
-1
if this value is negative and1
if it’s positive; otherwise,0
.func subtractingReportingOverflow(Int16
) -> (partialValue: Int16, overflow: Bool) Returns the difference obtained by subtracting the given value from this value, along with a Boolean value indicating whether overflow occurred in the operation.
struct SIMD16Storage
Storage for a vector of 16 integers.
struct SIMD2Storage
Storage for a vector of two integers.
struct SIMD32Storage
Storage for a vector of 32 integers.
struct SIMD4Storage
Storage for a vector of four integers.
struct SIMD64Storage
Storage for a vector of 64 integers.
struct SIMD8Storage
Storage for a vector of eight integers.
struct Words
A type that represents the words of this integer.
typealias IntegerLiteralType
A type that represents an integer literal.
typealias Magnitude
A type that can represent the absolute value of any possible value of this type.
typealias SIMDMaskScalar
var customPlaygroundQuickLook: _PlaygroundQuickLook
A custom playground Quick Look for the
Int16
instance.
Features
init(
) Creates a new value equal to zero.
init?<S>(S, radix: Int
) Creates a new integer value from the given string and radix.
static var max: Self
The maximum representable integer in this type.
static var min: Self
The minimum representable integer in this type.
static func random(in: ClosedRange<Self>
) -> Self Returns a random value within the specified range.
static func random(in: Range<Self>
) -> Self Returns a random value within the specified range.
static func random<T>(in: ClosedRange<Self>, using: inout T
) -> Self Returns a random value within the specified range, using the given generator as a source for randomness.
static func random<T>(in: Range<Self>, using: inout T
) -> Self Returns a random value within the specified range, using the given generator as a source for randomness.
static func != (Self, Self
) -> Bool static func != <Other>(Self, Other
) -> Bool Returns a Boolean value indicating whether the two given values are not equal.
static func != (Self, Self
) -> Bool static func &* (Self, Self
) -> Self Returns the product of the two given values, wrapping the result in case of any overflow.
static func &*= (inout Self, Self
) Multiplies two values and stores the result in the left-hand-side variable, wrapping any overflow.
static func &+ (Self, Self
) -> Self Returns the sum of the two given values, wrapping the result in case of any overflow.
static func &+= (inout Self, Self
) Adds two values and stores the result in the left-hand-side variable, wrapping any overflow.
static func &- (Self, Self
) -> Self Returns the difference of the two given values, wrapping the result in case of any overflow.
static func &-= (inout Self, Self
) Subtracts the second value from the first and stores the difference in the left-hand-side variable, wrapping any overflow.
static func + (Self
) -> Self Returns the given number unchanged.
static func ... (Self
) -> PartialRangeFrom<Self> Returns a partial range extending upward from a lower bound.
static func ... (Self
) -> PartialRangeThrough<Self> Returns a partial range up to, and including, its upper bound.
static func ... (Self, Self
) -> ClosedRange<Self> Returns a closed range that contains both of its bounds.
static func ..< (Self
) -> PartialRangeUpTo<Self> Returns a partial range up to, but not including, its upper bound.
static func ..< (Self, Self
) -> Range<Self> Returns a half-open range that contains its lower bound but not its upper bound.
static func < <Other>(Self, Other
) -> Bool Returns a Boolean value indicating whether the value of the first argument is less than that of the second argument.
static func <= <Other>(Self, Other
) -> Bool Returns a Boolean value indicating whether the value of the first argument is less than or equal to that of the second argument.
static func <= (Self, Self
) -> Bool static func == (Self, Self
) -> Bool static func == <Other>(Self, Other
) -> Bool Returns a Boolean value indicating whether the two given values are equal.
static func > <Other>(Self, Other
) -> Bool Returns a Boolean value indicating whether the value of the first argument is greater than that of the second argument.
static func > (Self, Self
) -> Bool static func >= <Other>(Self, Other
) -> Bool Returns a Boolean value indicating whether the value of the first argument is greater than or equal to that of the second argument.
static func >= (Self, Self
) -> Bool
Available in Foundation
Members
Extension in ArgumentParser
Conformances
protocol ExpressibleByArgument
A type that can be expressed as a command-line argument.
Extension in SwiftASN1
Conformances
protocol ASN1IntegerRepresentable
A protocol that represents any internal object that can present itself as an INTEGER, or be parsed from an INTEGER.
protocol DERImplicitlyTaggable
An ASN.1 node that can tolerate having an implicit tag.
protocol DERParseable
Defines a type that can be parsed from a DER-encoded form.
protocol DERSerializable
Defines a type that can be serialized in DER-encoded form.
Features
init(asn1Any: ASN1Any
) throws Construct this node from an ASN.1 ANY object.
init(asn1Any: ASN1Any, withIdentifier: ASN1Identifier
) throws Construct this node from an ASN.1 ANY object.
Extension in Atomics
Conformances
protocol AtomicInteger
A type that supports atomic integer operations through a separate atomic storage representation.
protocol AtomicValue
A type that supports atomic operations through a separate atomic storage representation.
Members
Extension in NIOConcurrencyHelpers
Conformances
protocol AtomicPrimitive
The protocol that all types that can be made atomic must conform to.
protocol NIOAtomicPrimitive
The protocol that all types that can be made atomic must conform to.
Members
static let atomic_add: (OpaquePointer, int_least16_t) -> int_least16_t
static let atomic_compare_and_exchange: (OpaquePointer, int_least16_t, int_least16_t) -> Bool
static let atomic_create: (int_least16_t) -> OpaquePointer
static let atomic_destroy: (OpaquePointer) -> Void
static let atomic_exchange: (OpaquePointer, int_least16_t) -> int_least16_t
static let atomic_load: (OpaquePointer) -> int_least16_t
static let atomic_store: (OpaquePointer, int_least16_t) -> Void
static let atomic_sub: (OpaquePointer, int_least16_t) -> int_least16_t
static let nio_atomic_add: (UnsafeMutablePointer<catmc_nio_atomic_int_least16_t>, int_least16_t) -> int_least16_t
static let nio_atomic_compare_and_exchange: (UnsafeMutablePointer<catmc_nio_atomic_int_least16_t>, int_least16_t, int_least16_t) -> Bool
static let nio_atomic_create_with_existing_storage: (UnsafeMutablePointer<catmc_nio_atomic_int_least16_t>, int_least16_t) -> Void
static let nio_atomic_exchange: (UnsafeMutablePointer<catmc_nio_atomic_int_least16_t>, int_least16_t) -> int_least16_t
static let nio_atomic_load: (UnsafeMutablePointer<catmc_nio_atomic_int_least16_t>) -> int_least16_t
static let nio_atomic_store: (UnsafeMutablePointer<catmc_nio_atomic_int_least16_t>, int_least16_t) -> Void
static let nio_atomic_sub: (UnsafeMutablePointer<catmc_nio_atomic_int_least16_t>, int_least16_t) -> int_least16_t
typealias AtomicWrapper
Extension in SwiftSyntaxBuilder
Conformances
protocol ExpressibleByLiteralSyntax
A Swift type whose value can be represented directly in source code by a Swift literal.