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

# BinaryInteger Implementations

## Topics

### Operators

[`static func != <Other>(Self, Other) -> Bool`](/documentation/Swift/Int128/!=(_:_:)-4l6xf)

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

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

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

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

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

[`static func == <Other>(Self, Other) -> Bool`](/documentation/Swift/Int128/==(_:_:)-31spp)

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

[`static func | (Self, Self) -> Self`](/documentation/Swift/Int128/_(_:_:)-120rc)

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

[`static func > <Other>(Self, Other) -> Bool`](/documentation/Swift/Int128/_(_:_:)-3jxf8)

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

[`static func / (Int128, Int128) -> Int128`](/documentation/Swift/Int128/_(_:_:)-3u29x)

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

[`static func % (Int128, Int128) -> Int128`](/documentation/Swift/Int128/_(_:_:)-4kr9j)

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

[`static func ^ (Self, Self) -> Self`](/documentation/Swift/Int128/_(_:_:)-4wqvr)

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

[`static func < <Other>(Self, Other) -> Bool`](/documentation/Swift/Int128/_(_:_:)-6c38s)

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

[`static func > (Self, Self) -> Bool`](/documentation/Swift/Int128/_(_:_:)-71bfg)

[`static func >= (Self, Self) -> Bool`](/documentation/Swift/Int128/_=(_:_:)-2rq25)

[`static func <= (Self, Self) -> Bool`](/documentation/Swift/Int128/_=(_:_:)-3tzf9)

[`static func /= (inout Int128, Int128)`](/documentation/Swift/Int128/_=(_:_:)-4hmtz)

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

[`static func %= (inout Int128, Int128)`](/documentation/Swift/Int128/_=(_:_:)-58nmj)

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

[`static func |= (inout Int128, Int128)`](/documentation/Swift/Int128/_=(_:_:)-791af)

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

[`static func >= <Other>(Self, Other) -> Bool`](/documentation/Swift/Int128/_=(_:_:)-90wyd)

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>(Self, Other) -> Bool`](/documentation/Swift/Int128/_=(_:_:)-9kicv)

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 ^= (inout Int128, Int128)`](/documentation/Swift/Int128/_=(_:_:)-ckwk)

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

[`static func >> <Other>(Self, Other) -> Self`](/documentation/Swift/Int128/__(_:_:)-10plt)

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

[`static func << <Other>(Self, Other) -> Self`](/documentation/Swift/Int128/__(_:_:)-30yed)

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

[`static func << <RHS>(Self, RHS) -> Self`](/documentation/Swift/Int128/__(_:_:)-6jhs3)

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

[`static func >> <RHS>(Self, RHS) -> Self`](/documentation/Swift/Int128/__(_:_:)-80gwd)

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

[`static func <<= <Other>(inout Self, Other)`](/documentation/Swift/Int128/__=(_:_:)-195op)

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>(inout Self, Other)`](/documentation/Swift/Int128/__=(_:_:)-3w1qu)

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 ~ (Self) -> Self`](/documentation/Swift/Int128/~(_:))

Returns the inverse of the bits set in the argument.

### Initializers

[`init()`](/documentation/Swift/Int128/init())

Creates a new value equal to zero.

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

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

[`init<T>(T)`](/documentation/Swift/Int128/init(_:)-95d5)

Creates a new instance from the given integer.

[`init<T>(clamping: T)`](/documentation/Swift/Int128/init(clamping:))

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

[`init<Other>(clamping: Other)`](/documentation/Swift/Int128/init(clamping:)-4ogm3)

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

[`init?<T>(exactly: T)`](/documentation/Swift/Int128/init(exactly:)-7ybhb)

Creates an integer from the given floating-point value, if it can be
represented exactly.

[`init<T>(truncatingIfNeeded: T)`](/documentation/Swift/Int128/init(truncatingIfNeeded:))

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

[`init<T>(truncatingIfNeeded: T)`](/documentation/Swift/Int128/init(truncatingIfNeeded:)-9tq25)

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

### Instance Properties

[`var bitWidth: Int`](/documentation/Swift/Int128/bitWidth-swift.property)

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

[`var description: String`](/documentation/Swift/Int128/description)

A textual representation of this value.

[`var trailingZeroBitCount: Int`](/documentation/Swift/Int128/trailingZeroBitCount)

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

[`var words: UInt128.Words`](/documentation/Swift/Int128/words-swift.property)

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

### Instance Methods

[`func advanced(by: Int) -> Self`](/documentation/Swift/Int128/advanced(by:))

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

[`func distance(to: Self) -> Int`](/documentation/Swift/Int128/distance(to:))

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

[`func isMultiple(of: Self) -> Bool`](/documentation/Swift/Int128/isMultiple(of:))

Returns `true` if this value is a multiple of the given value, and `false`
otherwise.

[`func quotientAndRemainder(dividingBy: Self) -> (quotient: Self, remainder: Self)`](/documentation/Swift/Int128/quotientAndRemainder(dividingBy:))

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

[`func signum() -> Self`](/documentation/Swift/Int128/signum())

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

### Type Aliases

[`typealias Words`](/documentation/Swift/Int128/Words-swift.typealias)

A type that represents the words of a binary integer.

---

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)