Structure

UInt32

A 32-bit unsigned integer value type.

Topics

Type Aliases

typealias UInt32.IntegerLiteralType

A type that represents an integer literal.

typealias UInt32.Magnitude

A type that can represent the absolute value of any possible value of this type.

Initializers

init()

Creates a new value equal to zero.

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(Float80)

Creates an integer from the given floating-point value, rounding toward zero.

init(NSNumber)Deprecated
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(Unicode.Scalar)

Construct with value v.value.

init?(String)

Creates a new integer value from the given string.

init?<S>(S, radix: Int)

Creates a new integer value from the given string and radix.

init(bigEndian: UInt32)

Creates an integer from its big-endian representation, changing the byte order if necessary.

init(bitPattern: Int32)

Creates a new instance with the same memory representation as the given value.

init<Other>(clamping: Other)

Creates a new instance with the representable value that’s closest to the given integer.

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: 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(integerLiteral: UInt32)

Creates an instance initialized to the specified integer value.

init(littleEndian: UInt32)

Creates an integer from its little-endian representation, changing the byte order if necessary.

init<T>(truncatingIfNeeded: T)

Creates a new instance from the bit pattern of the given instance by truncating or sign-extending if needed to fit this type.

Instance Properties

var bigEndian: UInt32

The big-endian representation of this integer.

var bitWidth: Int

The number of bits in the binary representation of this value.

var byteSwapped: UInt32

A representation of this integer with the byte order swapped.

var customMirror: Mirror

A mirror that reflects the UInt32 instance.

var customPlaygroundQuickLook: PlaygroundQuickLook

A custom playground Quick Look for the UInt32 instance.

Deprecated
var description: String

A textual representation of this value.

var hashValue: Int

The integer’s hash value.

var leadingZeroBitCount: Int

The number of leading zeros in this value’s binary representation.

var littleEndian: UInt32

The little-endian representation of this integer.

var magnitude: UInt32

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: UInt32.Words

A collection containing the words of this value’s binary representation, in order from the least significant to most significant.

Type Properties

static var bitWidth: Int

The number of bits used for the underlying binary representation of values of this type.

static var isSigned: Bool

A Boolean value indicating whether this type is a signed integer type.

static var max: UInt32

The maximum representable integer in this type.

static var min: UInt32

The minimum representable integer in this type.

Instance Methods

func addingReportingOverflow(UInt32) -> (partialValue: UInt32, 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) -> UInt32

Returns a value that is offset the specified distance from this value.

func distance(to: UInt32) -> Int

Returns the distance from this value to the given value, expressed as a stride.

func dividedReportingOverflow(by: UInt32) -> (partialValue: UInt32, 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: UInt32, low: UInt32.Magnitude)) -> (quotient: UInt32, remainder: UInt32)

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.

Beta
func multipliedFullWidth(by: UInt32) -> (high: UInt32, low: UInt32.Magnitude)

Returns a tuple containing the high and low parts of the result of multiplying this value by the given value.

func multipliedReportingOverflow(by: UInt32) -> (partialValue: UInt32, 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 quotientAndRemainder(dividingBy: UInt32) -> (quotient: UInt32, remainder: UInt32)

Returns the quotient and remainder of this value divided by the given value.

func remainderReportingOverflow(dividingBy: UInt32) -> (partialValue: UInt32, 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() -> UInt32

Returns -1 if this value is negative and 1 if it’s positive; otherwise, 0.

func subtractingReportingOverflow(UInt32) -> (partialValue: UInt32, 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.

func unsafeAdding(UInt32) -> UInt32

Returns the sum of this value and the given value without checking for arithmetic overflow.

func unsafeDivided(by: UInt32) -> UInt32

Returns the quotient obtained by dividing this value by the given value without checking for arithmetic overflow.

func unsafeMultiplied(by: UInt32) -> UInt32

Returns the product of this value and the given value without checking for arithmetic overflow.

func unsafeSubtracting(UInt32) -> UInt32

Returns the difference obtained by subtracting the given value from this value without checking for arithmetic overflow.

Type Methods

static func random(in: ClosedRange<UInt32>) -> UInt32

Returns a random value within the specified range.

Beta
static func random(in: Range<UInt32>) -> UInt32

Returns a random value within the specified range.

Beta
static func random<T>(in: ClosedRange<UInt32>, using: inout T) -> UInt32

Returns a random value within the specified range, using the given generator as a source for randomness.

Beta
static func random<T>(in: Range<UInt32>, using: inout T) -> UInt32

Returns a random value within the specified range, using the given generator as a source for randomness.

Beta

Operator Functions

static func != <Other>(UInt32, Other) -> Bool

Returns a Boolean value indicating whether the two given values are not equal.

static func != (UInt32, UInt32) -> Bool

Returns a Boolean value indicating whether two values are not equal.

Beta
static func % (UInt32, UInt32) -> UInt32

Returns the remainder of dividing the first value by the second.

static func %= (inout UInt32, UInt32)

Divides the first value by the second and stores the remainder in the left-hand-side variable.

static func & (UInt32, UInt32) -> UInt32

Returns the result of performing a bitwise AND operation on the two given values.

Beta
static func & (UInt32, UInt32) -> UInt32

Returns the result of performing a bitwise AND operation on the two given values.

Beta
static func &* (UInt32, UInt32) -> UInt32

Returns the product of the two given values, discarding any overflow.

static func &*= (inout UInt32, UInt32)

Multiplies two values and stores the result in the left-hand-side variable, discarding any overflow.

Beta
static func &+ (UInt32, UInt32) -> UInt32

Returns the sum of the two given values, discarding any overflow.

static func &+= (inout UInt32, UInt32)

Adds two values and stores the result in the left-hand-side variable, discarding any overflow.

Beta
static func &- (UInt32, UInt32) -> UInt32

Returns the difference of the two given values, discarding any overflow.

static func &-= (inout UInt32, UInt32)

Subtracts the second value from the first and stores the difference in the left-hand-side variable, discarding any overflow.

Beta
static func &<< <Other>(UInt32, Other) -> UInt32

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 &<< (UInt32, UInt32) -> UInt32

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.

Beta
static func &<< (UInt32, UInt32) -> UInt32

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.

Beta
static func &<<= (inout UInt32, UInt32)

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 UInt32, 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 UInt32, UInt32)

Stores the result of performing a bitwise AND operation on the two given values in the left-hand-side variable.

static func &>> <Other>(UInt32, Other) -> UInt32

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 &>> (UInt32, UInt32) -> UInt32

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.

Beta
static func &>> (UInt32, UInt32) -> UInt32

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.

Beta
static func &>>= (inout UInt32, UInt32)

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 &>>= <Other>(inout UInt32, 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 * (UInt32, UInt32) -> UInt32

Multiplies two values and produces their product.

static func *= (inout UInt32, UInt32)

Multiplies two values and stores the result in the left-hand-side variable.

static func + (UInt32) -> UInt32

Returns the given number unchanged.

static func + (UInt32, UInt32) -> UInt32

Adds two values and produces their sum.

static func += (inout UInt32, UInt32)

Adds two values and stores the result in the left-hand-side variable.

static func - (UInt32, UInt32) -> UInt32

Subtracts one value from another and produces their difference.

static func -= (inout UInt32, UInt32)

Subtracts the second value from the first and stores the difference in the left-hand-side variable.

static func ... (UInt32) -> PartialRangeFrom<UInt32>

Returns a partial range extending upward from a lower bound.

Beta
static func ... (UInt32) -> PartialRangeThrough<UInt32>

Returns a partial range up to, and including, its upper bound.

Beta
static func ... (UInt32, UInt32) -> ClosedRange<UInt32>

Returns a closed range that contains both of its bounds.

Beta
static func ... (UInt32, UInt32) -> ClosedRange<UInt32>

Returns a countable closed range that contains both of its bounds.

Beta
static func ..< (UInt32) -> PartialRangeUpTo<UInt32>

Returns a partial range up to, but not including, its upper bound.

static func ..< (UInt32, UInt32) -> Range<UInt32>

Returns a half-open range that contains its lower bound but not its upper bound.

Beta
static func / (UInt32, UInt32) -> UInt32

Returns the quotient of dividing the first value by the second.

static func /= (inout UInt32, UInt32)

Divides the first value by the second and stores the quotient in the left-hand-side variable.

static func < <Other>(UInt32, Other) -> Bool

Returns a Boolean value indicating whether the value of the first argument is less than that of the second argument.

static func < (UInt32, UInt32) -> Bool

Returns a Boolean value indicating whether the value of the first argument is less than that of the second argument.

Beta
static func << <Other>(UInt32, Other) -> UInt32

Returns the result of shifting a value’s binary representation the specified number of digits to the left.

static func << <RHS>(UInt32, RHS) -> UInt32

Returns the result of shifting a value’s binary representation the specified number of digits to the left.

static func <<= <Other>(inout UInt32, 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>(UInt32, 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 <= (UInt32, UInt32) -> Bool

Returns a Boolean value indicating whether the value of the first argument is less than or equal to that of the second argument.

Beta
static func <= (UInt32, UInt32) -> Bool

Returns a Boolean value indicating whether the value of the first argument is less than or equal to that of the second argument.

Beta
static func == <Other>(UInt32, Other) -> Bool

Returns a Boolean value indicating whether the two given values are equal.

static func == (UInt32, UInt32) -> Bool

Returns a Boolean value indicating whether two values are equal.

Beta
static func > <Other>(UInt32, Other) -> Bool

Returns a Boolean value indicating whether the value of the first argument is greater than that of the second argument.

static func > (UInt32, UInt32) -> Bool

Returns a Boolean value indicating whether the value of the first argument is greater than that of the second argument.

Beta
static func > (UInt32, UInt32) -> Bool

Returns a Boolean value indicating whether the value of the first argument is greater than that of the second argument.

Beta
static func >= <Other>(UInt32, 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 >= (UInt32, UInt32) -> Bool

Returns a Boolean value indicating whether the value of the first argument is greater than or equal to that of the second argument.

Beta
static func >= (UInt32, UInt32) -> Bool

Returns a Boolean value indicating whether the value of the first argument is greater than or equal to that of the second argument.

Beta
static func >> <Other>(UInt32, Other) -> UInt32

Returns the result of shifting a value’s binary representation the specified number of digits to the right.

static func >> <RHS>(UInt32, RHS) -> UInt32

Returns the result of shifting a value’s binary representation the specified number of digits to the right.

static func >>= <Other>(inout UInt32, 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 ^ (UInt32, UInt32) -> UInt32

Returns the result of performing a bitwise XOR operation on the two given values.

Beta
static func ^ (UInt32, UInt32) -> UInt32

Returns the result of performing a bitwise XOR operation on the two given values.

Beta
static func ^= (inout UInt32, UInt32)

Stores the result of performing a bitwise XOR operation on the two given values in the left-hand-side variable.

static func | (UInt32, UInt32) -> UInt32

Returns the result of performing a bitwise OR operation on the two given values.

Beta
static func | (UInt32, UInt32) -> UInt32

Returns the result of performing a bitwise OR operation on the two given values.

Beta
static func |= (inout UInt32, UInt32)

Stores the result of performing a bitwise OR operation on the two given values in the left-hand-side variable.

static func ~ (UInt32) -> UInt32

Returns the inverse of the bits set in the argument.

Structures

struct UInt32.Words

A type that represents the words of this integer.

See Also

Unsigned Integers

struct UInt

An unsigned integer value type.

struct UInt8

An 8-bit unsigned integer value type.

struct UInt16

A 16-bit unsigned integer value type.

struct UInt64

A 64-bit unsigned integer value type.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software