An unsigned integer value type.
SDK
- Xcode 6.0.1+
Framework
- Swift Standard Library
Declaration
@frozen struct UInt
Overview
On 32-bit platforms, UInt is the same size as UInt32, and on 64-bit platforms, UInt is the same size as UInt64.
An unsigned integer value type.
SDK
Framework
@frozen struct UInt
On 32-bit platforms, UInt is the same size as UInt32, and on 64-bit platforms, UInt is the same size as UInt64.
typealias UInt .Integer Literal TypeA type that represents an integer literal.
typealias UInt .MagnitudeA type that can represent the absolute value of any possible value of this type.
typealias UInt .StrideA type that represents the distance between two values.
init()Creates a new value equal to zero.
init(Double)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(Float)Creates an integer from the given floating-point value, rounding toward zero.
init<T>(T)Creates a new instance from the given integer.
init<T>(T)Creates an integer from the given floating-point value, rounding toward zero. Any fractional part of the value passed as source is removed.
init?(String)Creates a new integer value from the given string.
init(NSNumber)Deprecatedinit?<S>(S, radix: Int)Creates a new integer value from the given string and radix.
init(big Endian: UInt)Creates an integer from its big-endian representation, changing the byte order if necessary.
init(bit Pattern: Int)Creates a new instance with the same memory representation as the given value.
init(bit Pattern: Opaque Pointer?)Creates a new value with the bit pattern of the given pointer.
init(bit Pattern: Object Identifier)Creates an integer that captures the full value of the given object identifier.
init<P>(bit Pattern: P?)Creates a new value with the bit pattern of the given pointer.
init<Other>(clamping: Other)Creates a new instance with the representable value that’s closest to the given integer.
init?(exactly: Float)Creates an integer from the given floating-point value, if it can be represented exactly.
init?(exactly: Double)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?<T>(exactly: T)Creates an integer from the given floating-point value, if it can be represented exactly.
init?<T>(exactly: T)Creates a new instance from the given integer, if it can be represented exactly.
init(from: Decoder)Creates a new instance by decoding from the given decoder.
init(integer Literal: UInt)Creates an instance initialized to the specified integer value.
init(little Endian: UInt)Creates an integer from its little-endian representation, changing the byte order if necessary.
init<T>(truncating If Needed: T)Creates a new instance from the bit pattern of the given instance by truncating or sign-extending if needed to fit this type.
var big Endian: UIntThe big-endian representation of this integer.
var bit Width: IntThe number of bits in the binary representation of this value.
var byte Swapped: UIntA representation of this integer with the byte order swapped.
var custom Mirror: MirrorA mirror that reflects the UInt instance.
var custom Playground Quick Look: _Playground Quick LookA custom playground Quick Look for the UInt instance.
var description: StringA textual representation of this value.
var hash Value: IntThe hash value.
var leading Zero Bit Count: IntThe number of leading zeros in this value’s binary representation.
var little Endian: UIntThe little-endian representation of this integer.
var magnitude: UIntThe magnitude of this value.
var nonzero Bit Count: IntThe number of bits equal to 1 in this value’s binary representation.
var trailing Zero Bit Count: IntThe number of trailing zeros in this value’s binary representation.
var words: UInt .WordsA collection containing the words of this value’s binary representation, in order from the least significant to most significant.
static var bit Width: IntThe number of bits used for the underlying binary representation of values of this type.
static var is Signed: BoolA Boolean value indicating whether this type is a signed integer type.
static var max: UIntThe maximum representable integer in this type.
static var min: UIntThe minimum representable integer in this type.
static var zero: UIntThe zero value.
func adding Reporting Overflow(UInt) -> (partial Value: UInt, 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 advanced(by: Int) -> UIntReturns a value that is offset the specified distance from this value.
func distance(to: UInt) -> IntReturns the distance from this value to the given value, expressed as a stride.
func divided Reporting Overflow(by: UInt) -> (partial Value: UInt, 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 dividing Full Width((high: UInt, low: UInt .Magnitude)) -> (quotient: UInt, remainder: UInt)Returns a tuple containing the quotient and remainder of dividing the given value by this value.
func encode(to: Encoder)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 is Multiple(of: UInt) -> BoolReturns true if this value is a multiple of the given value, and false otherwise.
func multiplied Full Width(by: UInt) -> (high: UInt, low: UInt .Magnitude)Returns a tuple containing the high and low parts of the result of multiplying this value by the given value.
func multiplied Reporting Overflow(by: UInt) -> (partial Value: UInt, 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 quotient And Remainder(dividing By: UInt) -> (quotient: UInt, remainder: UInt)Returns the quotient and remainder of this value divided by the given value.
func remainder Reporting Overflow(dividing By: UInt) -> (partial Value: UInt, 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() -> UIntReturns -1 if this value is negative and 1 if it’s positive; otherwise, 0.
func subtracting Reporting Overflow(UInt) -> (partial Value: UInt, 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.
static func random(in: Closed Range<UInt>) -> UIntReturns a random value within the specified range.
static func random(in: Range<UInt>) -> UIntReturns a random value within the specified range.
static func random<T>(in: Closed Range<UInt>, using: inout T) -> UIntReturns a random value within the specified range, using the given generator as a source for randomness.
static func random<T>(in: Range<UInt>, using: inout T) -> UIntReturns a random value within the specified range, using the given generator as a source for randomness.
static func != <Other>(UInt, Other) -> BoolReturns a Boolean value indicating whether the two given values are not equal.
static func != (UInt, UInt) -> BoolReturns a Boolean value indicating whether two values are not equal.
static func % (UInt, UInt) -> UIntReturns the remainder of dividing the first value by the second.
static func %= (inout UInt, UInt)Divides the first value by the second and stores the remainder in the left-hand-side variable.
static func & (UInt, UInt) -> UIntReturns the result of performing a bitwise AND operation on the two given values.
static func & (UInt, UInt) -> UIntReturns the result of performing a bitwise AND operation on the two given values.
static func &* (UInt, UInt) -> UIntReturns the product of the two given values, wrapping the result in case of any overflow.
static func &*= (inout UInt, UInt)Multiplies two values and stores the result in the left-hand-side variable, wrapping any overflow.
static func &+ (UInt, UInt) -> UIntReturns the sum of the two given values, wrapping the result in case of any overflow.
static func &+= (inout UInt, UInt)Adds two values and stores the result in the left-hand-side variable, wrapping any overflow.
static func &- (UInt, UInt) -> UIntReturns the difference of the two given values, wrapping the result in case of any overflow.
static func &-= (inout UInt, UInt)Subtracts the second value from the first and stores the difference in the left-hand-side variable, wrapping any overflow.
static func &<< <Other>(UInt, Other) -> UIntReturns 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 &<< (UInt, UInt) -> UIntReturns 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 &<< (UInt, UInt) -> UIntReturns 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 UInt, UInt)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 &<<= <Other>(inout UInt, Other)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 UInt, UInt)Stores the result of performing a bitwise AND operation on the two given values in the left-hand-side variable.
static func &>> <Other>(UInt, Other) -> UIntReturns 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 &>> (UInt, UInt) -> UIntReturns 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 &>> (UInt, UInt) -> UIntReturns 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 &>>= <Other>(inout UInt, Other)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 &>>= (inout UInt, UInt)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 * (UInt, UInt) -> UIntMultiplies two values and produces their product.
static func *= (inout UInt, UInt)Multiplies two values and stores the result in the left-hand-side variable.
static func + (UInt) -> UIntReturns the given number unchanged.
static func + (UInt, UInt) -> UIntAdds two values and produces their sum.
static func += (inout UInt, UInt)Adds two values and stores the result in the left-hand-side variable.
static func - (UInt, UInt) -> UIntSubtracts one value from another and produces their difference.
static func -= (inout UInt, UInt)Subtracts the second value from the first and stores the difference in the left-hand-side variable.
static func ... (UInt) -> Partial Range From<UInt>Returns a partial range extending upward from a lower bound.
static func ... (UInt) -> Partial Range Through<UInt>Returns a partial range up to, and including, its upper bound.
static func ... (UInt, UInt) -> Closed Range<UInt>Returns a closed range that contains both of its bounds.
static func ..< (UInt) -> Partial Range Up To<UInt>Returns a partial range up to, but not including, its upper bound.
static func ..< (UInt, UInt) -> Range<UInt>Returns a half-open range that contains its lower bound but not its upper bound.
static func / (UInt, UInt) -> UIntReturns the quotient of dividing the first value by the second.
static func /= (inout UInt, UInt)Divides the first value by the second and stores the quotient in the left-hand-side variable.
static func < <Other>(UInt, Other) -> BoolReturns a Boolean value indicating whether the value of the first argument is less than that of the second argument.
static func < (UInt, UInt) -> BoolReturns a Boolean value indicating whether the value of the first argument is less than that of the second argument.
static func < (UInt, UInt) -> BoolReturns a Boolean value indicating whether the value of the first argument is less than that of the second argument.
static func << <Other>(UInt, Other) -> UIntReturns the result of shifting a value’s binary representation the specified number of digits to the left.
static func << <RHS>(UInt, RHS) -> UIntReturns the result of shifting a value’s binary representation the specified number of digits to the left.
static func <<= <Other>(inout UInt, Other)Stores the result of shifting a value’s binary representation the specified number of digits to the left in the left-hand-side variable.
static func <= <Other>(UInt, Other) -> BoolReturns a Boolean value indicating whether the value of the first argument is less than or equal to that of the second argument.
static func <= (UInt, UInt) -> BoolReturns a Boolean value indicating whether the value of the first argument is less than or equal to that of the second argument.
static func <= (UInt, UInt) -> BoolReturns a Boolean value indicating whether the value of the first argument is less than or equal to that of the second argument.
static func <= (UInt, UInt) -> BoolReturns a Boolean value indicating whether the value of the first argument is less than or equal to that of the second argument.
static func == <Other>(UInt, Other) -> BoolReturns a Boolean value indicating whether the two given values are equal.
static func == (UInt, UInt) -> BoolReturns a Boolean value indicating whether two values are equal.
static func == (UInt, UInt) -> BoolReturns a Boolean value indicating whether two values are equal.
static func > <Other>(UInt, Other) -> BoolReturns a Boolean value indicating whether the value of the first argument is greater than that of the second argument.
static func > (UInt, UInt) -> BoolReturns a Boolean value indicating whether the value of the first argument is greater than that of the second argument.
static func > (UInt, UInt) -> BoolReturns a Boolean value indicating whether the value of the first argument is greater than that of the second argument.
static func > (UInt, UInt) -> BoolReturns a Boolean value indicating whether the value of the first argument is greater than that of the second argument.
static func >= <Other>(UInt, Other) -> BoolReturns a Boolean value indicating whether the value of the first argument is greater than or equal to that of the second argument.
static func >= (UInt, UInt) -> BoolReturns a Boolean value indicating whether the value of the first argument is greater than or equal to that of the second argument.
static func >= (UInt, UInt) -> BoolReturns a Boolean value indicating whether the value of the first argument is greater than or equal to that of the second argument.
static func >= (UInt, UInt) -> BoolReturns a Boolean value indicating whether the value of the first argument is greater than or equal to that of the second argument.
static func >> <Other>(UInt, Other) -> UIntReturns the result of shifting a value’s binary representation the specified number of digits to the right.
static func >> <RHS>(UInt, RHS) -> UIntReturns the result of shifting a value’s binary representation the specified number of digits to the right.
static func >>= <Other>(inout UInt, Other)Stores the result of shifting a value’s binary representation the specified number of digits to the right in the left-hand-side variable.
static func ^ (UInt, UInt) -> UIntReturns the result of performing a bitwise XOR operation on the two given values.
static func ^ (UInt, UInt) -> UIntReturns the result of performing a bitwise XOR operation on the two given values.
static func ^= (inout UInt, UInt)Stores the result of performing a bitwise XOR operation on the two given values in the left-hand-side variable.
static func | (UInt, UInt) -> UIntReturns the result of performing a bitwise OR operation on the two given values.
static func | (UInt, UInt) -> UIntReturns the result of performing a bitwise OR operation on the two given values.
static func |= (inout UInt, UInt)Stores the result of performing a bitwise OR operation on the two given values in the left-hand-side variable.
static func ~ (UInt) -> UIntReturns the inverse of the bits set in the argument.
struct UInt .SIMD16StorageStorage for a vector of 16 integers.
struct UInt .SIMD2StorageStorage for a vector of two integers.
struct UInt .SIMD32StorageStorage for a vector of 32 integers.
struct UInt .SIMD4StorageStorage for a vector of four integers.
struct UInt .SIMD64StorageStorage for a vector of 64 integers.
struct UInt .SIMD8StorageStorage for a vector of eight integers.
struct UInt .WordsA type that represents the words of this integer.
struct UInt8An 8-bit unsigned integer value type.
struct UInt16A 16-bit unsigned integer value type.
struct UInt32A 32-bit unsigned integer value type.
struct UInt64A 64-bit unsigned integer value type.