<!--
{
  "documentType" : "article",
  "framework" : "Swift",
  "identifier" : "/documentation/Swift/binary-integer-operators",
  "metadataVersion" : "0.1.0",
  "role" : "collectionGroup",
  "title" : "Binary Integer Operators"
}
-->

# Binary Integer Operators

Perform arithmetic and bitwise operations or compare values.

## Topics

### Arithmetic

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

Adds two values and produces their sum.

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

Subtracts one value from another and produces their difference.

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

Multiplies two values and produces their product.

[`static func / (Self, Self) -> Self`](/documentation/Swift/BinaryInteger/_(_:_:)-8zc6l)

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

### Arithmetic with Assignment

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

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

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

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

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

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

[`static func /= (inout Self, Self)`](/documentation/Swift/BinaryInteger/_=(_:_:)-20xv1)

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

### Bitwise Operations

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

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

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

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

[`static func ~ (Self) -> Self`](/documentation/Swift/BinaryInteger/~(_:))

Returns the inverse of the bits set in the argument.

### Bit Shift

### Comparison

[`static func != <Other>(Self, Other) -> Bool`](/documentation/Swift/BinaryInteger/!=(_:_:)-9ooa7)

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

[`static func != (Self, Self) -> Bool`](/documentation/Swift/BinaryInteger/!=(_:_:)-4ljme)

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



---

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)