Structureswift 6.0.1Swift
UInt128
A 128-bit unsigned integer type.
- iOS
- 18.0+
- macOS
- 15.0+
- tvOS
- 18.0+
- visionOS
- 2.0+
- watchOS
- 11.0+
@frozen struct UInt128
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 BitwiseCopyable
protocol Comparable
A type that can be compared using the relational operators
<
,<=
,>=
, and>
.protocol Copyable
A type whose values can be implicitly or explicitly copied.
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 Escapable
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 Sendable
protocol Strideable<Stride>
A type representing continuous, one-dimensional values that can be offset and measured.
protocol UnsignedInteger
An integer type that can represent only nonnegative values.
Types
Typealiases
Type members
init<T>(T
) init<T>(T
) init(bitPattern: Int128
) init<T>(clamping: T
) init?<T>(exactly: T
) init?<T>(exactly: T
) init(from: any Decoder
) throws init<T>(truncatingIfNeeded: T
) static var bitWidth: Int
static var max: UInt128
static var min: UInt128
static var zero: UInt128
static func % (a: UInt128, b: UInt128
) -> UInt128 static func %= (a: inout UInt128, b: UInt128
) static func &<<= (a: inout UInt128, b: UInt128
) static func &= (a: inout UInt128, b: UInt128
) static func &>>= (a: inout UInt128, b: UInt128
) static func * (a: UInt128, b: UInt128
) -> UInt128 static func *= (a: inout UInt128, b: UInt128
) static func + (a: UInt128, b: UInt128
) -> UInt128 static func - (a: UInt128, b: UInt128
) -> UInt128 static func / (a: UInt128, b: UInt128
) -> UInt128 static func /= (a: inout UInt128, b: UInt128
) static func < (a: UInt128, b: UInt128
) -> Bool static func == (a: UInt128, b: UInt128
) -> Bool static func ^= (a: inout UInt128, b: UInt128
) static func |= (a: inout UInt128, b: UInt128
)
Instance members
var byteSwapped: UInt128
var customMirror: Mirror
A mirror that reflects the
UInt128
instance.var leadingZeroBitCount: Int
var magnitude: UInt128
var nonzeroBitCount: Int
var trailingZeroBitCount: Int
var words: UInt128.Words
func addingReportingOverflow(UInt128
) -> (partialValue: UInt128, overflow: Bool) func dividedReportingOverflow(by: UInt128
) -> (partialValue: UInt128, overflow: Bool) func encode(to: any Encoder
) throws Encodes this value into the given encoder.
func hash(into: inout Hasher
) func multipliedReportingOverflow(by: UInt128
) -> (partialValue: UInt128, overflow: Bool) func remainderReportingOverflow(dividingBy: UInt128
) -> (partialValue: UInt128, overflow: Bool) func subtractingReportingOverflow(UInt128
) -> (partialValue: UInt128, overflow: Bool)
Type features
init(
) Creates a new value equal to zero.
init<T>(T
) Creates a new instance from the given integer.
init?(String
) Creates a new integer value from the given string.
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?<S>(S, radix: Int
) Creates a new integer value from the given string and radix.
init(bigEndian: Self
) Creates an integer from its big-endian representation, changing the byte order if necessary.
init<Other>(clamping: Other
) Creates a new instance with the representable value that’s closest to the given integer.
init?<T>(exactly: T
) Creates a new instance from the given integer, 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(integerLiteral: Self
) init(littleEndian: Self
) 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.
static var isSigned: Bool
A Boolean value indicating whether this type is a signed integer type.
static var max: Self
The maximum representable integer in this type.
static var min: Self
The minimum representable integer in this type.
static var zero: Self
The zero value.
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 != (lhs: Self, rhs: Self
) -> Bool Returns a Boolean value indicating whether two values are not equal.
static func != <Other>(lhs: Self, rhs: Other
) -> Bool Returns a Boolean value indicating whether the two given values are not equal.
static func != (lhs: Self, rhs: Self
) -> Bool static func & (lhs: Self, rhs: Self
) -> Self Returns the result of performing a bitwise AND operation on the two given values.
static func &* (lhs: Self, rhs: Self
) -> Self static func &*= (lhs: inout Self, rhs: Self
) Multiplies two values and stores the result in the left-hand-side variable, wrapping any overflow.
static func &+ (lhs: Self, rhs: Self
) -> Self Returns the sum of the two given values, wrapping the result in case of any overflow.
static func &+= (lhs: inout Self, rhs: Self
) Adds two values and stores the result in the left-hand-side variable, wrapping any overflow.
static func &- (lhs: Self, rhs: Self
) -> Self Returns the difference of the two given values, wrapping the result in case of any overflow.
static func &-= (lhs: inout Self, rhs: Self
) Subtracts the second value from the first and stores the difference in the left-hand-side variable, wrapping any overflow.
static func &<< <Other>(lhs: Self, rhs: Other
) -> Self 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 &<< (lhs: Self, rhs: Self
) -> Self 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 &<<= <Other>(lhs: inout Self, rhs: 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 &>> <Other>(lhs: Self, rhs: Other
) -> Self 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 &>> (lhs: Self, rhs: Self
) -> Self 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 &>>= <Other>(lhs: inout Self, rhs: 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 + (x: Self
) -> Self Returns the given number unchanged.
static func += (lhs: inout Self, rhs: Self
) static func -= (lhs: inout Self, rhs: Self
) static func ... (minimum: Self
) -> PartialRangeFrom<Self> Returns a partial range extending upward from a lower bound.
static func ... (maximum: Self
) -> PartialRangeThrough<Self> Returns a partial range up to, and including, its upper bound.
static func ... (minimum: Self, maximum: Self
) -> ClosedRange<Self> Returns a closed range that contains both of its bounds.
static func ..< (maximum: Self
) -> PartialRangeUpTo<Self> Returns a partial range up to, but not including, its upper bound.
static func ..< (minimum: Self, maximum: Self
) -> Range<Self> Returns a half-open range that contains its lower bound but not its upper bound.
static func < (x: Self, y: Self
) -> Bool static func < <Other>(lhs: Self, rhs: Other
) -> Bool Returns a Boolean value indicating whether the value of the first argument is less than that of the second argument.
static func << <RHS>(lhs: Self, rhs: RHS
) -> Self Returns the result of shifting a value’s binary representation the specified number of digits to the left.
static func << <Other>(lhs: Self, rhs: Other
) -> Self Returns the result of shifting a value’s binary representation the specified number of digits to the left.
static func <<= <Other>(lhs: inout Self, rhs: Other
) static func <= (lhs: Self, rhs: Self
) -> 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 <= <Other>(lhs: Self, rhs: 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 <= (lhs: Self, rhs: Self
) -> Bool static func == (x: Self, y: Self
) -> Bool static func == <Other>(lhs: Self, rhs: Other
) -> Bool Returns a Boolean value indicating whether the two given values are equal.
static func > (lhs: Self, rhs: Self
) -> Bool Returns a Boolean value indicating whether the value of the first argument is greater than that of the second argument.
static func > <Other>(lhs: Self, rhs: Other
) -> Bool Returns a Boolean value indicating whether the value of the first argument is greater than that of the second argument.
static func > (lhs: Self, rhs: Self
) -> Bool static func >= (lhs: Self, rhs: Self
) -> 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 >= <Other>(lhs: Self, rhs: 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 >= (lhs: Self, rhs: Self
) -> Bool static func >> <RHS>(lhs: Self, rhs: RHS
) -> Self Returns the result of shifting a value’s binary representation the specified number of digits to the right.
static func >> <Other>(lhs: Self, rhs: Other
) -> Self Returns the result of shifting a value’s binary representation the specified number of digits to the right.
static func >>= <Other>(lhs: inout Self, rhs: Other
) static func ^ (lhs: Self, rhs: Self
) -> Self Returns the result of performing a bitwise XOR operation on the two given values.
static func | (lhs: Self, rhs: Self
) -> Self Returns the result of performing a bitwise OR operation on the two given values.
static func ~ (x: Self
) -> Self Returns the inverse of the bits set in the argument.
Instance features
var bigEndian: Self
The big-endian representation of this integer.
var bitWidth: Int
The number of bits in the binary representation of this value.
var description: String
A textual representation of this value.
var littleEndian: Self
The little-endian representation of this integer.
func advanced(by: Int
) -> Self Returns a value that is offset the specified distance from this value.
func distance(to: Self
) -> Int Returns the distance from this value to the given value, expressed as a stride.
func dividingFullWidth((high: Self, low: Self.Magnitude)
) -> (quotient: Self, remainder: Self) func isMultiple(of: Self
) -> Bool func multipliedFullWidth(by: Self
) -> (high: Self, low: Self.Magnitude) func quotientAndRemainder(dividingBy: Self
) -> (quotient: Self, remainder: Self) Returns the quotient and remainder of this value divided by the given value.
func signum(
) -> Self Returns
-1
if this value is negative and1
if it’s positive; otherwise,0
.
Available in Synchronization
Conformances
protocol AtomicRepresentable
A type that supports atomic operations through a separate atomic storage representation.