<!--
{
  "documentType" : "article",
  "framework" : "Swift",
  "identifier" : "/documentation/Swift/UInt128/FixedWidthInteger-Implementations",
  "metadataVersion" : "0.1.0",
  "role" : "collectionGroup",
  "title" : "FixedWidthInteger Implementations"
}
-->

# FixedWidthInteger Implementations

## Topics

### Operators

[`static func &* (Self, Self) -> Self`](/documentation/Swift/UInt128/&*(_:_:))

Returns the product of the two given values, wrapping the result in case
of any overflow.

[`static func &*= (inout Self, Self)`](/documentation/Swift/UInt128/&*=(_:_:))

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

[`static func &+ (Self, Self) -> Self`](/documentation/Swift/UInt128/&+(_:_:))

Returns the sum of the two given values, wrapping the result in case of
any overflow.

[`static func &+= (inout Self, Self)`](/documentation/Swift/UInt128/&+=(_:_:))

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

[`static func &- (Self, Self) -> Self`](/documentation/Swift/UInt128/&-(_:_:))

Returns the difference of the two given values, wrapping the result in
case of any overflow.

[`static func &-= (inout Self, Self)`](/documentation/Swift/UInt128/&-=(_:_:))

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

[`static func &<< <Other>(Self, Other) -> Self`](/documentation/Swift/UInt128/&__(_:_:)-6im7h)

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 &<< (Self, Self) -> Self`](/documentation/Swift/UInt128/&__(_:_:)-6vbmo)

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>(Self, Other) -> Self`](/documentation/Swift/UInt128/&__(_:_:)-7vshb)

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 &>> (Self, Self) -> Self`](/documentation/Swift/UInt128/&__(_:_:)-t1dt)

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 UInt128, UInt128)`](/documentation/Swift/UInt128/&__=(_:_:)-2trlh)

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 Self, Other)`](/documentation/Swift/UInt128/&__=(_:_:)-7h6z1)

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 Self, Other)`](/documentation/Swift/UInt128/&__=(_:_:)-c0o3)

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 UInt128, UInt128)`](/documentation/Swift/UInt128/&__=(_:_:)-l1y8)

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.

### Initializers

[`init<T>(T)`](/documentation/Swift/UInt128/init(_:)-7l4pg)

[`init?(String)`](/documentation/Swift/UInt128/init(_:)-7reec)

Creates a new integer value from the given string.

[`init?<S>(S, radix: Int)`](/documentation/Swift/UInt128/init(_:radix:))

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

[`init(bigEndian: Self)`](/documentation/Swift/UInt128/init(bigEndian:))

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

[`init?<T>(exactly: T)`](/documentation/Swift/UInt128/init(exactly:)-4u158)

[`init(littleEndian: Self)`](/documentation/Swift/UInt128/init(littleEndian:))

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

### Instance Properties

[`var bigEndian: Self`](/documentation/Swift/UInt128/bigEndian)

The big-endian representation of this integer.

[`var byteSwapped: UInt128`](/documentation/Swift/UInt128/byteSwapped)

A representation of this integer with the byte order swapped.

[`var leadingZeroBitCount: Int`](/documentation/Swift/UInt128/leadingZeroBitCount)

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

[`var littleEndian: Self`](/documentation/Swift/UInt128/littleEndian)

The little-endian representation of this integer.

[`var nonzeroBitCount: Int`](/documentation/Swift/UInt128/nonzeroBitCount)

The number of bits equal to 1 in this value’s binary representation.

### Instance Methods

[`func addingReportingOverflow(UInt128) -> (partialValue: UInt128, overflow: Bool)`](/documentation/Swift/UInt128/addingReportingOverflow(_:))

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: UInt128) -> (partialValue: UInt128, overflow: Bool)`](/documentation/Swift/UInt128/dividedReportingOverflow(by:))

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 multipliedFullWidth(by: Self) -> (high: Self, low: Self.Magnitude)`](/documentation/Swift/UInt128/multipliedFullWidth(by:))

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

[`func multipliedReportingOverflow(by: UInt128) -> (partialValue: UInt128, overflow: Bool)`](/documentation/Swift/UInt128/multipliedReportingOverflow(by:))

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: UInt128) -> (partialValue: UInt128, overflow: Bool)`](/documentation/Swift/UInt128/remainderReportingOverflow(dividingBy:))

Returns the remainder after dividing this value by the given value, along
with a Boolean value indicating whether overflow occurred during division.

[`func subtractingReportingOverflow(UInt128) -> (partialValue: UInt128, overflow: Bool)`](/documentation/Swift/UInt128/subtractingReportingOverflow(_:))

Returns the difference obtained by subtracting the given value from this
value, along with a Boolean value indicating whether overflow occurred in
the operation.

### Type Properties

[`static var bitWidth: Int`](/documentation/Swift/UInt128/bitWidth)

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

[`static var max: UInt128`](/documentation/Swift/UInt128/max)

The maximum representable integer in this type.

[`static var min: UInt128`](/documentation/Swift/UInt128/min)

The minimum representable integer in this type.

### Type Methods

[`static func random(in: ClosedRange<Self>) -> Self`](/documentation/Swift/UInt128/random(in:)-1tk4g)

Returns a random value within the specified range.

[`static func random(in: Range<Self>) -> Self`](/documentation/Swift/UInt128/random(in:)-6h05w)

Returns a random value within the specified range.

[`static func random<T>(in: Range<Self>, using: inout T) -> Self`](/documentation/Swift/UInt128/random(in:using:)-1acx9)

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

[`static func random<T>(in: ClosedRange<Self>, using: inout T) -> Self`](/documentation/Swift/UInt128/random(in:using:)-535e1)

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

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)