Operator: &+

operator &+ { associativity left precedence }

Declarations

func &+(_: Self, rhs: Self)

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

The masking addition operator (&+) silently discards any overflow that occurs during the operation. In the following example, the sum of 100 and 121 is greater than the maximum representable Int8 value, so the result is the overflowed value:

let x: Int8 = 10 &+ 21
// x == 31
let y: Int8 = 100 &+ 121
// y == -35 (after overflow)

Parameters: lhs: The first value to add. rhs: The second value to add.

Declaration

func &+(lhs: Self, rhs: Self) -> Self

Declared In

FixedWidthInteger, SignedInteger
func &+(_: Self, rhs: Self)

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

The masking addition operator (&+) silently discards any overflow that occurs during the operation. In the following example, the sum of 100 and 121 is greater than the maximum representable Int8 value, so the result is the overflowed value:

let x: Int8 = 10 &+ 21
// x == 31
let y: Int8 = 100 &+ 121
// y == -35 (after overflow)

Parameters: lhs: The first value to add. rhs: The second value to add.

Declaration

func &+(lhs: Self, rhs: Self) -> Self

Declared In

FixedWidthInteger, SignedInteger
func &+(_: Self, rhs: Self)

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

The masking addition operator (&+) silently discards any overflow that occurs during the operation. In the following example, the sum of 100 and 121 is greater than the maximum representable Int8 value, so the result is the overflowed value:

let x: Int8 = 10 &+ 21
// x == 31
let y: Int8 = 100 &+ 121
// y == -35 (after overflow)

Parameters: lhs: The first value to add. rhs: The second value to add.

Declaration

func &+(lhs: Self, rhs: Self) -> Self

Declared In

FixedWidthInteger, SignedInteger
func &+(_: Self, rhs: Self)

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

The masking addition operator (&+) silently discards any overflow that occurs during the operation. In the following example, the sum of 100 and 121 is greater than the maximum representable Int8 value, so the result is the overflowed value:

let x: Int8 = 10 &+ 21
// x == 31
let y: Int8 = 100 &+ 121
// y == -35 (after overflow)

Parameters: lhs: The first value to add. rhs: The second value to add.

Declaration

func &+(lhs: Self, rhs: Self) -> Self

Declared In

FixedWidthInteger, SignedInteger
func &+(_: Self, rhs: Self)

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

The masking addition operator (&+) silently discards any overflow that occurs during the operation. In the following example, the sum of 100 and 121 is greater than the maximum representable Int8 value, so the result is the overflowed value:

let x: Int8 = 10 &+ 21
// x == 31
let y: Int8 = 100 &+ 121
// y == -35 (after overflow)

Parameters: lhs: The first value to add. rhs: The second value to add.

Declaration

func &+(lhs: Self, rhs: Self) -> Self

Declared In

FixedWidthInteger, SignedInteger
func &+(_: Self, rhs: Self)

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

The masking addition operator (&+) silently discards any overflow that occurs during the operation. In the following example, the sum of 100 and 121 is greater than the maximum representable Int8 value, so the result is the overflowed value:

let x: Int8 = 10 &+ 21
// x == 31
let y: Int8 = 100 &+ 121
// y == -35 (after overflow)

Parameters: lhs: The first value to add. rhs: The second value to add.

Declaration

func &+(lhs: Self, rhs: Self) -> Self

Declared In

FixedWidthInteger
func &+(_: Self, rhs: Self)

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

The masking addition operator (&+) silently discards any overflow that occurs during the operation. In the following example, the sum of 100 and 121 is greater than the maximum representable Int8 value, so the result is the overflowed value:

let x: Int8 = 10 &+ 21
// x == 31
let y: Int8 = 100 &+ 121
// y == -35 (after overflow)

Parameters: lhs: The first value to add. rhs: The second value to add.

Declaration

func &+(lhs: Self, rhs: Self) -> Self

Declared In

FixedWidthInteger
func &+(_: Self, rhs: Self)

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

The masking addition operator (&+) silently discards any overflow that occurs during the operation. In the following example, the sum of 100 and 121 is greater than the maximum representable Int8 value, so the result is the overflowed value:

let x: Int8 = 10 &+ 21
// x == 31
let y: Int8 = 100 &+ 121
// y == -35 (after overflow)

Parameters: lhs: The first value to add. rhs: The second value to add.

Declaration

func &+(lhs: Self, rhs: Self) -> Self

Declared In

FixedWidthInteger
func &+(_: Self, rhs: Self)

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

The masking addition operator (&+) silently discards any overflow that occurs during the operation. In the following example, the sum of 100 and 121 is greater than the maximum representable Int8 value, so the result is the overflowed value:

let x: Int8 = 10 &+ 21
// x == 31
let y: Int8 = 100 &+ 121
// y == -35 (after overflow)

Parameters: lhs: The first value to add. rhs: The second value to add.

Declaration

func &+(lhs: Self, rhs: Self) -> Self

Declared In

FixedWidthInteger
func &+(_: Self, rhs: Self)

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

The masking addition operator (&+) silently discards any overflow that occurs during the operation. In the following example, the sum of 100 and 121 is greater than the maximum representable Int8 value, so the result is the overflowed value:

let x: Int8 = 10 &+ 21
// x == 31
let y: Int8 = 100 &+ 121
// y == -35 (after overflow)

Parameters: lhs: The first value to add. rhs: The second value to add.

Declaration

func &+(lhs: Self, rhs: Self) -> Self

Declared In

FixedWidthInteger