Instance Method


Returns the product of this value and the given value without checking for arithmetic overflow.


func unsafeMultiplied(by other: Int32) -> Int32



The value to multiply by this value.

Return Value

The product of this value and rhs.


Use this function only to avoid the cost of overflow checking when you are certain that the operation won’t overflow. In optimized builds (-O) the compiler is free to assume that overflow won’t occur. Failure to satisfy that assumption is a serious programming error and could lead to statements being unexpectedly executed or skipped.

In debug builds (-Onone) a runtime error is still triggered if the operation overflows.

This method is not a synonym for the masking multiplication operator (&*). Use that operator instead of this method when you want to discard any overflow that results from an addition operation.