Interface
interface CheckedOp<T>
public interface CheckedOp<T> {
func checkedAdd(y: T): ?T
func checkedDec(): ?T
func checkedDiv(y: T): ?T
func checkedInc(): ?T
func checkedMod(y: T): ?T
func checkedMul(y: T): ?T
func checkedNeg(): ?T
func checkedShl(y: T): ?T
func checkedShr(y: T): ?T
func checkedSub(y: T): ?T
}
Description: Returns None
when an overflow occurs in an integer operation.
func checkedAdd(T)
func checkedAdd(y: T): ?T
Description: Performs addition operation using the policy of returning Option.
When an overflow occurs in an operation, ?T.None
is returned. Otherwise, the operation result is returned.
Parameters:
- y: T: addend
Returns:
- ?T: addition operation result
func checkedDec()
func checkedDec(): ?T
Description: Performs auto-decrement operation using the policy of returning Option.
When an overflow occurs in an operation, ?T.None
is returned. Otherwise, the operation result is returned.
Returns:
- ?T: auto-decrement operation result
func checkedDiv(T)
func checkedDiv(y: T): ?T
Description: Performs division operation using the policy of returning Option.
When an overflow occurs in an operation, ?T.None
is returned. Otherwise, the operation result is returned.
Parameters:
- y: T: divisor
Returns:
- ?T: division operation result
func checkedInc()
func checkedInc(): ?T
Description: Performs auto-increment operation using the policy of returning Option.
When an overflow occurs in an operation, ?T.None
is returned. Otherwise, the operation result is returned.
Returns:
- ?T: auto-increment operation result
func checkedMod(T)
func checkedMod(y: T): ?T
Description: Performs modulo operation using the policy of returning Option.
When an overflow occurs in an operation, ?T.None
is returned. Otherwise, the operation result is returned.
Parameters:
- y: T: divisor
Returns:
- ?T: modulo operation result
func checkedMul(T)
func checkedMul(y: T): ?T
Description: Performs multiplication operation using the policy of returning Option.
When an overflow occurs in an operation, ?T.None
is returned. Otherwise, the operation result is returned.
Parameters:
- y: T: multiplier
Returns:
- ?T: multiplication operation result
func checkedNeg()
func checkedNeg(): ?T
Description: Performs negation operation using the policy of returning Option.
When an overflow occurs in an operation, ?T.None
is returned. Otherwise, the operation result is returned.
Returns:
- ?T: negation operation result
func checkedShl(T)
func checkedShl(y: T): ?T
Description: Performs left shift operation using the policy of returning Option.
When the number of bits to shift by is greater than or equal to that of operand bits or is less than 0, ?T.None
is returned. Otherwise, the operation result is returned.
Parameters:
- y: T: number of bits to shift by
Returns:
- ?T: left shift operation result
func checkedShr(T)
func checkedShr(y: T): ?T
Description: Performs right shift operation using the policy of returning Option.
When the number of bits to shift by is greater than or equal to that of operand bits or is less than 0, ?T.None
is returned. Otherwise, the operation result is returned.
Parameters:
- y: T: number of bits to shift by
Returns:
- ?T: right shift operation result
func checkedSub(T)
func checkedSub(y: T): ?T
Description: Performs subtraction operation using the policy of returning Option.
When an overflow occurs in an operation, ?T.None
is returned. Otherwise, the operation result is returned.
Parameters:
- y: T: subtrahend
Returns:
- ?T: subtraction operation result
extend Int16 <: CheckedOp<Int16>
extend Int16 <: CheckedOp<Int16>
Description: Implements the CheckedOp interface for Int16.
Parent Type:
func checkedAdd(Int16)
public func checkedAdd(y: Int16): ?Int16
Description: Performs addition operation using the policy of returning Option.
When an overflow occurs in an operation, ?Int16.None is returned. Otherwise, the operation result is returned.
Parameters:
- y: Int16: addend
Returns:
- ?Int16: addition operation result
func checkedDec()
public func checkedDec(): ?Int16
Description: Performs auto-decrement operation using the policy of returning Option.
When an overflow occurs in an operation, ?Int16.None is returned. Otherwise, the operation result is returned.
Returns:
- ?Int16: auto-decrement operation result
func checkedDiv(Int16)
public func checkedDiv(y: Int16): ?Int16
Description: Performs division operation using the policy of returning Option.
When an overflow occurs in an operation, ?Int16.None is returned. Otherwise, the operation result is returned.
Parameters:
- y: Int16: divisor
Returns:
- ?Int16: division operation result
func checkedInc()
public func checkedInc(): ?Int16
Description: Performs auto-increment operation using the policy of returning Option.
When an overflow occurs in an operation, ?Int16.None is returned. Otherwise, the operation result is returned.
Returns:
- ?Int16: auto-increment operation result
func checkedMod(Int16)
public func checkedMod(y: Int16): ?Int16
Description: Performs modulo operation using the policy of returning Option.
When an overflow occurs in an operation, ?Int16.None is returned. Otherwise, the operation result is returned.
Parameters:
- y: Int16: divisor
Returns:
- ?Int16: modulo operation result
func checkedMul(Int16)
public func checkedMul(y: Int16): ?Int16
Description: Performs multiplication operation using the policy of returning Option.
When an overflow occurs in an operation, ?Int16.None is returned. Otherwise, the operation result is returned.
Parameters:
- y: Int16: multiplier
Returns:
- ?Int16: multiplication operation result
func checkedNeg()
public func checkedNeg(): ?Int16
Description: Performs negation operation using the policy of returning Option.
When an overflow occurs in an operation, ?Int16.None is returned. Otherwise, the operation result is returned.
Returns:
- ?Int16: negation operation result
func checkedShl(Int16)
public func checkedShl(y: Int16): ?Int16
Description: Performs left shift operation using the policy of returning Option.
When the number of bits to shift by is greater than or equal to that of operand bits or is less than 0, ?Int16.None is returned. Otherwise, the operation result is returned.
Parameters:
- y: Int16: number of bits to shift by
Returns:
- ?Int16: left shift operation result
func checkedShr(Int16)
public func checkedShr(y: Int16): ?Int16
Description: Performs right shift operation using the policy of returning Option.
When the number of bits to shift by is greater than or equal to that of operand bits or is less than 0, ?Int16.None is returned. Otherwise, the operation result is returned.
Parameters:
- y: Int16: number of bits to shift by
Returns:
- ?Int16: right shift operation result
func checkedSub(Int16)
public func checkedSub(y: Int16): ?Int16
Description: Performs subtraction operation using the policy of returning Option.
When an overflow occurs in an operation, ?Int16.None is returned. Otherwise, the operation result is returned.
Parameters:
- y: Int16: subtrahend
Returns:
- ?Int16: subtraction operation result
extend Int32 <: CheckedOp<Int32>
extend Int32 <: CheckedOp<Int32>
Description: Implements the CheckedOp interface for Int32.
Parent Type:
func checkedAdd(Int32)
public func checkedAdd(y: Int32): ?Int32
Description: Performs addition operation using the policy of returning Option.
When an overflow occurs in an operation, ?Int32.None is returned. Otherwise, the operation result is returned.
Parameters:
- y: Int32: addend
Returns:
- ?Int32: addition operation result
func checkedDec()
public func checkedDec(): ?Int32
Description: Performs auto-decrement operation using the policy of returning Option.
When an overflow occurs in an operation, ?Int32.None is returned. Otherwise, the operation result is returned.
Returns:
- ?Int32: auto-decrement operation result
func checkedDiv(Int32)
public func checkedDiv(y: Int32): ?Int32
Description: Performs division operation using the policy of returning Option.
When an overflow occurs in an operation, ?Int32.None is returned. Otherwise, the operation result is returned.
Parameters:
- y: Int32: divisor
Returns:
- ?Int32: division operation result
func checkedInc()
public func checkedInc(): ?Int32
Description: Performs auto-increment operation using the policy of returning Option.
When an overflow occurs in an operation, ?Int32.None is returned. Otherwise, the operation result is returned.
Returns:
- ?Int32: auto-increment operation result
func checkedMod(Int32)
public func checkedMod(y: Int32): ?Int32
Description: Performs modulo operation using the policy of returning Option.
When an overflow occurs in an operation, ?Int32.None is returned. Otherwise, the operation result is returned.
Parameters:
- y: Int32: divisor
Returns:
- ?Int32: modulo operation result
func checkedMul(Int32)
public func checkedMul(y: Int32): ?Int32
Description: Performs multiplication operation using the policy of returning Option.
When an overflow occurs in an operation, ?Int32.None is returned. Otherwise, the operation result is returned.
Parameters:
- y: Int32: multiplier
Returns:
- ?Int32: multiplication operation result
func checkedNeg()
public func checkedNeg(): ?Int32
Description: Performs negation operation using the policy of returning Option.
When an overflow occurs in an operation, ?Int32.None is returned. Otherwise, the operation result is returned.
Returns:
- ?Int32: negation operation result
func checkedShl(Int32)
public func checkedShl(y: Int32): ?Int32
Description: Performs left shift operation using the policy of returning Option.
When the number of bits to shift by is greater than or equal to that of operand bits or is less than 0, ?Int32.None is returned. Otherwise, the operation result is returned.
Parameters:
- y: Int32: number of bits to shift by
Returns:
- ?Int32: left shift operation result
func checkedShr(Int32)
public func checkedShr(y: Int32): ?Int32
Description: Performs right shift operation using the policy of returning Option.
When the number of bits to shift by is greater than or equal to that of operand bits or is less than 0, ?Int32.None is returned. Otherwise, the operation result is returned.
Parameters:
- y: Int32: number of bits to shift by
Returns:
- ?Int32: right shift operation result
func checkedSub(Int32)
public func checkedSub(y: Int32): ?Int32
Description: Performs subtraction operation using the policy of returning Option.
When an overflow occurs in an operation, ?Int32.None is returned. Otherwise, the operation result is returned.
Parameters:
- y: Int32: subtrahend
Returns:
- ?Int32: subtraction operation result
extend Int64 <: CheckedOp<Int64>
extend Int64 <: CheckedOp<Int64>
Description: Implements the CheckedOp interface for Int64.
Parent Type:
func checkedAdd(Int64)
public func checkedAdd(y: Int64): ?Int64
Description: Performs addition operation using the policy of returning Option.
When an overflow occurs in an operation, ?Int64.None is returned. Otherwise, the operation result is returned.
Parameters:
- y: Int64: addend
Returns:
- ?Int64: addition operation result
func checkedDec()
public func checkedDec(): ?Int64
Description: Performs auto-decrement operation using the policy of returning Option.
When an overflow occurs in an operation, ?Int64.None is returned. Otherwise, the operation result is returned.
Returns:
- ?Int64: auto-decrement operation result
func checkedDiv(Int64)
public func checkedDiv(y: Int64): ?Int64
Description: Performs division operation using the policy of returning Option.
When an overflow occurs in an operation, ?Int64.None is returned. Otherwise, the operation result is returned.
Parameters:
- y: Int64: divisor
Returns:
- ?Int64: division operation result
func checkedInc()
public func checkedInc(): ?Int64
Description: Performs auto-increment operation using the policy of returning Option.
When an overflow occurs in an operation, ?Int64.None is returned. Otherwise, the operation result is returned.
Returns:
- ?Int64: auto-increment operation result
func checkedMod(Int64)
public func checkedMod(y: Int64): ?Int64
Description: Performs modulo operation using the policy of returning Option.
When an overflow occurs in an operation, ?Int64.None is returned. Otherwise, the operation result is returned.
Parameters:
- y: Int64: divisor
Returns:
- ?Int64: modulo operation result
func checkedMul(Int64)
public func checkedMul(y: Int64): ?Int64
Description: Performs multiplication operation using the policy of returning Option.
When an overflow occurs in an operation, ?Int64.None is returned. Otherwise, the operation result is returned.
Parameters:
- y: Int64: multiplier
Returns:
- ?Int64: multiplication operation result
func checkedNeg()
public func checkedNeg(): ?Int64
Description: Performs negation operation using the policy of returning Option.
When an overflow occurs in an operation, ?Int64.None is returned. Otherwise, the operation result is returned.
Returns:
- ?Int64: negation operation result
func checkedPow(UInt64)
public func checkedPow(y: UInt64): ?Int64
Description: Performs exponentiation operation using the policy of returning Option.
When an overflow occurs in an operation, ?Int64.None is returned. Otherwise, the operation result is returned.
Parameters:
- y: UInt64: exponent
Returns:
- ?Int64: exponentiation operation result
func checkedShl(Int64)
public func checkedShl(y: Int64): ?Int64
Description: Performs left shift operation using the policy of returning Option.
When the number of bits to shift by is greater than or equal to that of operand bits or is less than 0, ?Int64.None is returned. Otherwise, the operation result is returned.
Parameters:
- y: Int64: number of bits to shift by
Returns:
- ?Int64: left shift operation result
func checkedShr(Int64)
public func checkedShr(y: Int64): ?Int64
Description: Performs right shift operation using the policy of returning Option.
When the number of bits to shift by is greater than or equal to that of operand bits or is less than 0, ?Int64.None is returned. Otherwise, the operation result is returned.
Parameters:
- y: Int64: number of bits to shift by
Returns:
- ?Int64: right shift operation result
func checkedSub(Int64)
public func checkedSub(y: Int64): ?Int64
Description: Performs subtraction operation using the policy of returning Option.
When an overflow occurs in an operation, ?Int64.None is returned. Otherwise, the operation result is returned.
Parameters:
- y: Int64: subtrahend
Returns:
- ?Int64: subtraction operation result
extend Int8 <: CheckedOp<Int8>
extend Int8 <: CheckedOp<Int8>
Description: Implements the CheckedOp interface for Int8.
Parent Type:
func checkedAdd(Int8)
public func checkedAdd(y: Int8): ?Int8
Description: Performs addition operation using the policy of returning Option.
When an overflow occurs in an operation, ?Int8.None is returned. Otherwise, the operation result is returned.
Parameters:
- y: Int8: addend
Returns:
- ?Int8: addition operation result
func checkedDec()
public func checkedDec(): ?Int8
Description: Performs auto-decrement operation using the policy of returning Option.
When an overflow occurs in an operation, ?Int8.None is returned. Otherwise, the operation result is returned.
Returns:
- ?Int8: auto-decrement operation result
func checkedDiv(Int8)
public func checkedDiv(y: Int8): ?Int8
Description: Performs division operation using the policy of returning Option.
When an overflow occurs in an operation, ?Int8.None is returned. Otherwise, the operation result is returned.
Parameters:
- y: Int8: divisor
Returns:
- ?Int8: division operation result
func checkedInc()
public func checkedInc(): ?Int8
Description: Performs auto-increment operation using the policy of returning Option.
When an overflow occurs in an operation, ?Int8.None is returned. Otherwise, the operation result is returned.
Returns:
- ?Int8: auto-increment operation result
func checkedMod(Int8)
public func checkedMod(y: Int8): ?Int8
Description: Performs modulo operation using the policy of returning Option.
When an overflow occurs in an operation, ?Int8.None is returned. Otherwise, the operation result is returned.
Parameters:
- y: Int8: divisor
Returns:
- ?Int8: modulo operation result
func checkedMul(Int8)
public func checkedMul(y: Int8): ?Int8
Description: Performs multiplication operation using the policy of returning Option.
When an overflow occurs in an operation, ?Int8.None is returned. Otherwise, the operation result is returned.
Parameters:
- y: Int8: multiplier
Returns:
- ?Int8: multiplication operation result
func checkedNeg()
public func checkedNeg(): ?Int8
Description: Performs negation operation using the policy of returning Option.
When an overflow occurs in an operation, ?Int8.None is returned. Otherwise, the operation result is returned.
Returns:
- ?Int8: negation operation result
func checkedShl(Int8)
public func checkedShl(y: Int8): ?Int8
Description: Performs left shift operation using the policy of returning Option.
When the number of bits to shift by is greater than or equal to that of operand bits or is less than 0, ?Int8.None is returned. Otherwise, the operation result is returned.
Parameters:
- y: Int8: number of bits to shift by
Returns:
- ?Int8: left shift operation result
func checkedShr(Int8)
public func checkedShr(y: Int8): ?Int8
Description: Performs right shift operation using the policy of returning Option.
When the number of bits to shift by is greater than or equal to that of operand bits or is less than 0, ?Int8.None is returned. Otherwise, the operation result is returned.
Parameters:
- y: Int8: number of bits to shift by
Returns:
- ?Int8: right shift operation result
func checkedSub(Int8)
public func checkedSub(y: Int8): ?Int8
Description: Performs subtraction operation using the policy of returning Option.
When an overflow occurs in an operation, ?Int8.None is returned. Otherwise, the operation result is returned.
Parameters:
- y: Int8: subtrahend
Returns:
- ?Int8: subtraction operation result
extend IntNative <: CheckedOp<IntNative>
extend IntNative <: CheckedOp<IntNative>
Description: Implements the CheckedOp interface for IntNative.
Parent Type:
func checkedAdd(IntNative)
public func checkedAdd(y: IntNative): ?IntNative
Description: Performs addition operation using the policy of returning Option.
When an overflow occurs in an operation, ?IntNative.None is returned. Otherwise, the operation result is returned.
Parameters:
- y: IntNative: addend
Returns:
- ?IntNative: addition operation result
func checkedDec()
public func checkedDec(): ?IntNative
Description: Performs auto-decrement operation using the policy of returning Option.
When an overflow occurs in an operation, ?IntNative.None is returned. Otherwise, the operation result is returned.
Returns:
- ?IntNative: auto-decrement operation result
func checkedDiv(IntNative)
public func checkedDiv(y: IntNative): ?IntNative
Description: Performs division operation using the policy of returning Option.
When an overflow occurs in an operation, ?IntNative.None is returned. Otherwise, the operation result is returned.
Parameters:
- y: IntNative: divisor
Returns:
- ?IntNative: division operation result
func checkedInc()
public func checkedInc(): ?IntNative
Description: Performs auto-increment operation using the policy of returning Option.
When an overflow occurs in an operation, ?IntNative.None is returned. Otherwise, the operation result is returned.
Returns:
- ?IntNative: auto-increment operation result
func checkedMod(IntNative)
public func checkedMod(y: IntNative): ?IntNative
Description: Performs modulo operation using the policy of returning Option.
When an overflow occurs in an operation, ?IntNative.None is returned. Otherwise, the operation result is returned.
Parameters:
- y: IntNative: divisor
Returns:
- ?IntNative: modulo operation result
func checkedMul(IntNative)
public func checkedMul(y: IntNative): ?IntNative
Description: Performs multiplication operation using the policy of returning Option.
When an overflow occurs in an operation, ?IntNative.None is returned. Otherwise, the operation result is returned.
Parameters:
- y: IntNative: multiplier
Returns:
- ?IntNative: multiplication operation result
func checkedNeg()
public func checkedNeg(): ?IntNative
Description: Performs negation operation using the policy of returning Option.
When an overflow occurs in an operation, ?IntNative.None is returned. Otherwise, the operation result is returned.
Returns:
- ?IntNative: negation operation result
func checkedShl(IntNative)
public func checkedShl(y: IntNative): ?IntNative
Description: Performs left shift operation using the policy of returning Option.
When the number of bits to shift by is greater than or equal to that of operand bits or is less than 0, ?IntNative.None is returned. Otherwise, the operation result is returned.
Parameters:
- y: IntNative: number of bits to shift by
Returns:
- ?IntNative: left shift operation result
func checkedShr(IntNative)
public func checkedShr(y: IntNative): ?IntNative
Description: Performs right shift operation using the policy of returning Option.
When the number of bits to shift by is greater than or equal to that of operand bits or is less than 0, ?IntNative.None is returned. Otherwise, the operation result is returned.
Parameters:
- y: IntNative: number of bits to shift by
Returns:
- ?IntNative: right shift operation result
func checkedSub(IntNative)
public func checkedSub(y: IntNative): ?IntNative
Description: Performs subtraction operation using the policy of returning Option.
When an overflow occurs in an operation, ?IntNative.None is returned. Otherwise, the operation result is returned.
Parameters:
- y: IntNative: subtrahend
Returns:
- ?IntNative: subtraction operation result
extend UInt16 <: CheckedOp<UInt16>
extend UInt16 <: CheckedOp<UInt16>
Description: Implements the CheckedOp interface for UInt16.
Parent Type:
func checkedAdd(UInt16)
public func checkedAdd(y: UInt16): ?UInt16
Description: Performs addition operation using the policy of returning Option.
When an overflow occurs in an operation, ?UInt16.None is returned. Otherwise, the operation result is returned.
Parameters:
- y: UInt16: addend
Returns:
- ?UInt16: addition operation result
func checkedDec()
public func checkedDec(): ?UInt16
Description: Performs auto-decrement operation using the policy of returning Option.
When an overflow occurs in an operation, ?UInt16.None is returned. Otherwise, the operation result is returned.
Returns:
- ?UInt16: auto-decrement operation result
func checkedDiv(UInt16)
public func checkedDiv(y: UInt16): ?UInt16
Description: Performs division operation using the policy of returning Option.
When an overflow occurs in an operation, ?UInt16.None is returned. Otherwise, the operation result is returned.
Parameters:
- y: UInt16: divisor
Returns:
- ?UInt16: division operation result
func checkedInc()
public func checkedInc(): ?UInt16
Description: Performs auto-increment operation using the policy of returning Option.
When an overflow occurs in an operation, ?UInt16.None is returned. Otherwise, the operation result is returned.
Returns:
- ?UInt16: auto-increment operation result
func checkedMod(UInt16)
public func checkedMod(y: UInt16): ?UInt16
Description: Performs modulo operation using the policy of returning Option.
When an overflow occurs in an operation, ?UInt16.None is returned. Otherwise, the operation result is returned.
Parameters:
- y: UInt16: divisor
Returns:
- ?UInt16: modulo operation result
func checkedMul(UInt16)
public func checkedMul(y: UInt16): ?UInt16
Description: Performs multiplication operation using the policy of returning Option.
When an overflow occurs in an operation, ?UInt16.None is returned. Otherwise, the operation result is returned.
Parameters:
- y: UInt16: multiplier
Returns:
- ?UInt16: multiplication operation result
func checkedNeg()
public func checkedNeg(): ?UInt16
Description: Performs negation operation using the policy of returning Option.
When an overflow occurs in an operation, ?UInt16.None is returned. Otherwise, the operation result is returned.
Returns:
- ?UInt16: negation operation result
func checkedShl(UInt16)
public func checkedShl(y: UInt16): ?UInt16
Description: Performs left shift operation using the policy of returning Option.
When the number of bits to shift by is greater than or equal to that of operand bits, ?UInt16.None is returned. Otherwise, the operation result is returned.
Parameters:
- y: UInt16: number of bits to shift by
Returns:
- ?UInt16: left shift operation result
func checkedShr(UInt16)
public func checkedShr(y: UInt16): ?UInt16
Description: Performs right shift operation using the policy of returning Option.
When the number of bits to shift by is greater than or equal to that of operand bits, ?UInt16.None is returned. Otherwise, the operation result is returned.
Parameters:
- y: UInt16: number of bits to shift by
Returns:
- ?UInt16: right shift operation result
func checkedSub(UInt16)
public func checkedSub(y: UInt16): ?UInt16
Description: Performs subtraction operation using the policy of returning Option.
When an overflow occurs in an operation, ?UInt16.None is returned. Otherwise, the operation result is returned.
Parameters:
- y: UInt16: subtrahend
Returns:
- ?UInt16: subtraction operation result
extend UInt32 <: CheckedOp<UInt32>
extend UInt32 <: CheckedOp<UInt32>
Description: Implements the CheckedOp interface for UInt32.
Parent Type:
func checkedAdd(UInt32)
public func checkedAdd(y: UInt32): ?UInt32
Description: Performs addition operation using the policy of returning Option.
When an overflow occurs in an operation, ?UInt32.None is returned. Otherwise, the operation result is returned.
Parameters:
- y: UInt32: addend
Returns:
- ?UInt32: addition operation result
func checkedDec()
public func checkedDec(): ?UInt32
Description: Performs auto-decrement operation using the policy of returning Option.
When an overflow occurs in an operation, ?UInt32.None is returned. Otherwise, the operation result is returned.
Returns:
- ?UInt32: auto-decrement operation result
func checkedDiv(UInt32)
public func checkedDiv(y: UInt32): ?UInt32
Description: Performs division operation using the policy of returning Option.
When an overflow occurs in an operation, ?UInt32.None is returned. Otherwise, the operation result is returned.
Parameters:
- y: UInt32: divisor
Returns:
- ?UInt32: division operation result
func checkedInc()
public func checkedInc(): ?UInt32
Description: Performs auto-increment operation using the policy of returning Option.
When an overflow occurs in an operation, ?UInt32.None is returned. Otherwise, the operation result is returned.
Returns:
- ?UInt32: auto-increment operation result
func checkedMod(UInt32)
public func checkedMod(y: UInt32): ?UInt32
Description: Performs modulo operation using the policy of returning Option.
When an overflow occurs in an operation, ?UInt32.None is returned. Otherwise, the operation result is returned.
Parameters:
- y: UInt32: divisor
Returns:
- ?UInt32: modulo operation result
func checkedMul(UInt32)
public func checkedMul(y: UInt32): ?UInt32
Description: Performs multiplication operation using the policy of returning Option.
When an overflow occurs in an operation, ?UInt32.None is returned. Otherwise, the operation result is returned.
Parameters:
- y: UInt32: multiplier
Returns:
- ?UInt32: multiplication operation result
func checkedNeg()
public func checkedNeg(): ?UInt32
Description: Performs negation operation using the policy of returning Option.
When an overflow occurs in an operation, ?UInt32.None is returned. Otherwise, the operation result is returned.
Returns:
- ?UInt32: negation operation result
func checkedShl(UInt32)
public func checkedShl(y: UInt32): ?UInt32
Description: Performs left shift operation using the policy of returning Option.
When the number of bits to shift by is greater than or equal to that of operand bits, ?UInt32.None is returned. Otherwise, the operation result is returned.
Parameters:
- y: UInt32: number of bits to shift by
Returns:
- ?UInt32: left shift operation result
func checkedShr(UInt32)
public func checkedShr(y: UInt32): ?UInt32
Description: Performs right shift operation using the policy of returning Option.
When the number of bits to shift by is greater than or equal to that of operand bits, ?UInt32.None is returned. Otherwise, the operation result is returned.
Parameters:
- y: UInt32: number of bits to shift by
Returns:
- ?UInt32: right shift operation result
func checkedSub(UInt32)
public func checkedSub(y: UInt32): ?UInt32
Description: Performs subtraction operation using the policy of returning Option.
When an overflow occurs in an operation, ?UInt32.None is returned. Otherwise, the operation result is returned.
Parameters:
- y: UInt32: subtrahend
Returns:
- ?UInt32: subtraction operation result
extend UInt64 <: CheckedOp<UInt64>
extend UInt64 <: CheckedOp<UInt64>
Description: Implements the CheckedOp interface for UInt64.
Parent Type:
func checkedAdd(UInt64)
public func checkedAdd(y: UInt64): ?UInt64
Description: Performs addition operation using the policy of returning Option.
When an overflow occurs in an operation, ?UInt64.None is returned. Otherwise, the operation result is returned.
Parameters:
- y: UInt64: addend
Returns:
- ?UInt64: addition operation result
func checkedDec()
public func checkedDec(): ?UInt64
Description: Performs auto-decrement operation using the policy of returning Option.
When an overflow occurs in an operation, ?UInt64.None is returned. Otherwise, the operation result is returned.
Returns:
- ?UInt64: auto-decrement operation result
func checkedDiv(UInt64)
public func checkedDiv(y: UInt64): ?UInt64
Description: Performs division operation using the policy of returning Option.
When an overflow occurs in an operation, ?UInt64.None is returned. Otherwise, the operation result is returned.
Parameters:
- y: UInt64: divisor
Returns:
- ?UInt64: division operation result
func checkedInc()
public func checkedInc(): ?UInt64
Description: Performs auto-increment operation using the policy of returning Option.
When an overflow occurs in an operation, ?UInt64.None is returned. Otherwise, the operation result is returned.
Returns:
- ?UInt64: auto-increment operation result
func checkedMod(UInt64)
public func checkedMod(y: UInt64): ?UInt64
Description: Performs modulo operation using the policy of returning Option.
When an overflow occurs in an operation, ?UInt64.None is returned. Otherwise, the operation result is returned.
Parameters:
- y: UInt64: divisor
Returns:
- ?UInt64: modulo operation result
func checkedMul(UInt64)
public func checkedMul(y: UInt64): ?UInt64
Description: Performs multiplication operation using the policy of returning Option.
When an overflow occurs in an operation, ?UInt64.None is returned. Otherwise, the operation result is returned.
Parameters:
- y: UInt64: multiplier
Returns:
- ?UInt64: multiplication operation result
func checkedNeg()
public func checkedNeg(): ?UInt64
Description: Performs negation operation using the policy of returning Option.
When an overflow occurs in an operation, ?UInt64.None is returned. Otherwise, the operation result is returned.
Returns:
- ?UInt64: negation operation result
func checkedShl(UInt64)
public func checkedShl(y: UInt64): ?UInt64
Description: Performs left shift operation using the policy of returning Option.
When the number of bits to shift by is greater than or equal to that of operand bits, ?UInt64.None is returned. Otherwise, the operation result is returned.
Parameters:
- y: UInt64: number of bits to shift by
Returns:
- ?UInt64: left shift operation result
func checkedShr(UInt64)
public func checkedShr(y: UInt64): ?UInt64
Description: Performs right shift operation using the policy of returning Option.
When the number of bits to shift by is greater than or equal to that of operand bits, ?UInt64.None is returned. Otherwise, the operation result is returned.
Parameters:
- y: UInt64: number of bits to shift by
Returns:
- ?UInt64: right shift operation result
func checkedSub(UInt64)
public func checkedSub(y: UInt64): ?UInt64
Description: Performs subtraction operation using the policy of returning Option.
When an overflow occurs in an operation, ?UInt64.None is returned. Otherwise, the operation result is returned.
Parameters:
- y: UInt64: subtrahend
Returns:
- ?UInt64: subtraction operation result
extend UInt8 <: CheckedOp<UInt8>
extend UInt8 <: CheckedOp<UInt8>
Description: Implements the CheckedOp interface for UInt8.
Parent Type:
func checkedAdd(UInt8)
public func checkedAdd(y: UInt8): ?UInt8
Description: Performs addition operation using the policy of returning Option.
When an overflow occurs in an operation, ?UInt8.None is returned. Otherwise, the operation result is returned.
Parameters:
- y: UInt8: addend
Returns:
- ?UInt8: addition operation result
func checkedDec()
public func checkedDec(): ?UInt8
Description: Performs auto-decrement operation using the policy of returning Option.
When an overflow occurs in an operation, ?UInt8.None is returned. Otherwise, the operation result is returned.
Returns:
- ?UInt8: auto-decrement operation result
func checkedDiv(UInt8)
public func checkedDiv(y: UInt8): ?UInt8
Description: Performs division operation using the policy of returning Option.
When an overflow occurs in an operation, ?UInt8.None is returned. Otherwise, the operation result is returned.
Parameters:
- y: UInt8: divisor
Returns:
- ?UInt8: division operation result
func checkedInc()
public func checkedInc(): ?UInt8
Description: Performs auto-increment operation using the policy of returning Option.
When an overflow occurs in an operation, ?UInt8.None is returned. Otherwise, the operation result is returned.
Returns:
- ?UInt8: auto-increment operation result
func checkedMod(UInt8)
public func checkedMod(y: UInt8): ?UInt8
Description: Performs modulo operation using the policy of returning Option.
When an overflow occurs in an operation, ?UInt8.None is returned. Otherwise, the operation result is returned.
Parameters:
- y: UInt8: divisor
Returns:
- ?UInt8: modulo operation result
func checkedMul(UInt8)
public func checkedMul(y: UInt8): ?UInt8
Description: Performs multiplication operation using the policy of returning Option.
When an overflow occurs in an operation, ?UInt8.None is returned. Otherwise, the operation result is returned.
Parameters:
- y: UInt8: multiplier
Returns:
- ?UInt8: multiplication operation result
func checkedNeg()
public func checkedNeg(): ?UInt8
Description: Performs negation operation using the policy of returning Option.
When an overflow occurs in an operation, ?UInt8.None is returned. Otherwise, the operation result is returned.
Returns:
- ?UInt8: negation operation result
func checkedShl(UInt8)
public func checkedShl(y: UInt8): ?UInt8
Description: Performs left shift operation using the policy of returning Option.
When the number of bits to shift by is greater than or equal to that of operand bits, ?UInt8.None is returned. Otherwise, the operation result is returned.
Parameters:
- y: UInt8: number of bits to shift by
Returns:
- ?UInt8: left shift operation result
func checkedShr(UInt8)
public func checkedShr(y: UInt8): ?UInt8
Description: Performs right shift operation using the policy of returning Option.
When the number of bits to shift by is greater than or equal to that of operand bits, ?UInt8.None is returned. Otherwise, the operation result is returned.
Parameters:
- y: UInt8: number of bits to shift by
Returns:
- ?UInt8: right shift operation result
func checkedSub(UInt8)
public func checkedSub(y: UInt8): ?UInt8
Description: Performs subtraction operation using the policy of returning Option.
When an overflow occurs in an operation, ?UInt8.None is returned. Otherwise, the operation result is returned.
Parameters:
- y: UInt8: subtrahend
Returns:
- ?UInt8: subtraction operation result
extend UIntNative <: CheckedOp<UIntNative>
extend UIntNative <: CheckedOp<UIntNative>
Description: Implements the CheckedOp interface for UIntNative.
Parent Type:
func checkedAdd(UIntNative)
public func checkedAdd(y: UIntNative): ?UIntNative
Description: Performs addition operation using the policy of returning Option.
When an overflow occurs in an operation, ?UIntNative.None is returned. Otherwise, the operation result is returned.
Parameters:
- y: UIntNative: addend
Returns:
- ?UIntNative: addition operation result
func checkedDec()
public func checkedDec(): ?UIntNative
Description: Performs auto-decrement operation using the policy of returning Option.
When an overflow occurs in an operation, ?UIntNative.None is returned. Otherwise, the operation result is returned.
Returns:
- ?UIntNative: auto-decrement operation result
func checkedDiv(UIntNative)
public func checkedDiv(y: UIntNative): ?UIntNative
Description: Performs division operation using the policy of returning Option.
When an overflow occurs in an operation, ?UIntNative.None is returned. Otherwise, the operation result is returned.
Parameters:
- y: UIntNative: divisor
Returns:
- ?UIntNative: division operation result
func checkedInc()
public func checkedInc(): ?UIntNative
Description: Performs auto-increment operation using the policy of returning Option.
When an overflow occurs in an operation, ?UIntNative.None is returned. Otherwise, the operation result is returned.
Returns:
- ?UIntNative: auto-increment operation result
func checkedMod(UIntNative)
public func checkedMod(y: UIntNative): ?UIntNative
Description: Performs modulo operation using the policy of returning Option.
When an overflow occurs in an operation, ?UIntNative.None is returned. Otherwise, the operation result is returned.
Parameters:
- y: UIntNative: divisor
Returns:
- ?UIntNative: modulo operation result
func checkedMul(UIntNative)
public func checkedMul(y: UIntNative): ?UIntNative
Description: Performs multiplication operation using the policy of returning Option.
When an overflow occurs in an operation, ?UIntNative.None is returned. Otherwise, the operation result is returned.
Parameters:
- y: UIntNative: multiplier
Returns:
- ?UIntNative: multiplication operation result
func checkedNeg()
public func checkedNeg(): ?UIntNative
Description: Performs negation operation using the policy of returning Option.
When an overflow occurs in an operation, ?UIntNative.None is returned. Otherwise, the operation result is returned.
Returns:
- ?UIntNative: negation operation result
func checkedShl(UIntNative)
public func checkedShl(y: UIntNative): ?UIntNative
Description: Performs left shift operation using the policy of returning Option.
When the number of bits to shift by is greater than or equal to that of operand bits, ?UIntNative.None is returned. Otherwise, the operation result is returned.
Parameters:
- y: UIntNative: number of bits to shift by
Returns:
- ?UIntNative: left shift operation result
func checkedShr(UIntNative)
public func checkedShr(y: UIntNative): ?UIntNative
Description: Performs right shift operation using the policy of returning Option.
When the number of bits to shift by is greater than or equal to that of operand bits, ?UIntNative.None is returned. Otherwise, the operation result is returned.
Parameters:
- y: UIntNative: number of bits to shift by
Returns:
- ?UIntNative: right shift operation result
func checkedSub(UIntNative)
public func checkedSub(y: UIntNative): ?UIntNative
Description: Performs subtraction operation using the policy of returning Option.
When an overflow occurs in an operation, ?UIntNative.None is returned. Otherwise, the operation result is returned.
Parameters:
- y: UIntNative: subtrahend
Returns:
- ?UIntNative: subtraction operation result
interface SaturatingOp<T>
public interface SaturatingOp<T> {
func saturatingAdd(y: T): T
func saturatingDec(): T
func saturatingDiv(y: T): T
func saturatingInc(): T
func saturatingMod(y: T): T
func saturatingMul(y: T): T
func saturatingNeg(): T
func saturatingShl(y: T): T
func saturatingShr(y: T): T
func saturatingSub(y: T): T
}
Description: Performs saturation operation when an overflow occurs in an integer operation.
func saturatingAdd(T)
func saturatingAdd(y: T): T
Description: Performs addition operation using the saturation policy.
When an overflow occurs in an operation, the maximum value of the operand type is returned. When an underflow occurs in an operation, the minimum value of the operand type is returned. Otherwise, the operation result is returned.
Parameters:
- y: T: addend
Returns:
- T: addition operation result
func saturatingDec()
func saturatingDec(): T
Description: Performs auto-decrement operation using the saturation policy.
When an underflow occurs in an operation, the minimum value of the operand type is returned. Otherwise, the operation result is returned.
Returns:
- T: auto-decrement operation result
func saturatingDiv(T)
func saturatingDiv(y: T): T
Description: Performs division operation using the saturation policy.
When an overflow occurs in an operation, the maximum value of the operand type is returned. Otherwise, the operation result is returned.
Parameters:
- y: T: divisor
Returns:
- T: division operation result
func saturatingInc()
func saturatingInc(): T
Description: Performs auto-increment operation using the saturation policy.
When an overflow occurs in an operation, the maximum value of the operand type is returned. Otherwise, the operation result is returned.
Returns:
- T: auto-increment operation result
func saturatingMod(T)
func saturatingMod(y: T): T
Description: Performs modulo operation using the saturation policy.
When an overflow occurs in an operation, the maximum value of the operand type is returned. Otherwise, the operation result is returned.
Parameters:
- y: T: divisor
Returns:
- T: modulo operation result
func saturatingMul(T)
func saturatingMul(y: T): T
Description: Performs multiplication operation using the saturation policy.
When an overflow occurs in an operation, the maximum value of the operand type is returned. When an underflow occurs in an operation, the minimum value of the operand type is returned. Otherwise, the operation result is returned.
Parameters:
- y: T: multiplier
Returns:
- T: multiplication operation result
func saturatingNeg()
func saturatingNeg(): T
Description: Performs negation operation using the saturation policy.
When an overflow occurs in an operation, the maximum value of the operand type is returned. When an underflow occurs in an operation, the minimum value of the operand type is returned. Otherwise, the operation result is returned.
Returns:
- T: negation operation result
func saturatingShl(T)
func saturatingShl(y: T): T
Description: Performs left shift operation using the saturation policy.
When the number of bits to shift by is greater than or equal to that of operand bits, the number of bits to shift by is set to the number of operand bits minus 1. When the number of bits to shift by is less than 0, it is set to 0. Otherwise, the operation result is returned.
Parameters:
- y: T: number of bits to shift by
Returns:
- T: left shift operation result
func saturatingShr(T)
func saturatingShr(y: T): T
Description: Performs right shift operation using the saturation policy.
When the number of bits to shift by is greater than or equal to that of operand bits, the number of bits to shift by is set to the number of operand bits minus 1. When the number of bits to shift by is less than 0, it is set to 0. Otherwise, the operation result is returned.
Parameters:
- y: T: number of bits to shift by
Returns:
- T: right shift operation result
func saturatingSub(T)
func saturatingSub(y: T): T
Description: Performs subtraction operation using the saturation policy.
When an overflow occurs in an operation, the maximum value of the operand type is returned. When an underflow occurs in an operation, the minimum value of the operand type is returned. Otherwise, the operation result is returned.
Parameters:
- y: T: subtrahend
Returns:
- T: subtraction operation result
extend Int16 <: SaturatingOp<Int16>
extend Int16 <: SaturatingOp<Int16>
Description: Implements the SaturatingOp interface for Int16.
Parent Type:
func saturatingAdd(Int16)
public func saturatingAdd(y: Int16): Int16
Description: Performs addition operation using the saturation policy.
When an overflow occurs in an operation, the maximum value of the operand type is returned. When an underflow occurs in an operation, the minimum value of the operand type is returned. Otherwise, the operation result is returned.
Parameters:
- y: Int16: addend
Returns:
- Int16: addition operation result
func saturatingDec()
public func saturatingDec(): Int16
Description: Performs auto-decrement operation using the saturation policy.
When an underflow occurs in an operation, the minimum value of the operand type is returned. Otherwise, the operation result is returned.
Returns:
- Int16: auto-decrement operation result
func saturatingDiv(Int16)
public func saturatingDiv(y: Int16): Int16
Description: Performs division operation using the saturation policy.
When an overflow occurs in an operation, the maximum value of the operand type is returned. Otherwise, the operation result is returned.
Parameters:
- y: Int16: divisor
Returns:
- Int16: division operation result
func saturatingInc()
public func saturatingInc(): Int16
Description: Performs auto-increment operation using the saturation policy.
When an overflow occurs in an operation, the maximum value of the operand type is returned. Otherwise, the operation result is returned.
Returns:
- Int16: auto-increment operation result
func saturatingMod(Int16)
public func saturatingMod(y: Int16): Int16
Description: Performs modulo operation using the saturation policy.
When an overflow occurs in an operation, the maximum value of the operand type is returned. Otherwise, the operation result is returned.
Parameters:
- y: Int16: divisor
Returns:
- Int16: modulo operation result
func saturatingMul(Int16)
public func saturatingMul(y: Int16): Int16
Description: Performs multiplication operation using the saturation policy.
When an overflow occurs in an operation, the maximum value of the operand type is returned. When an underflow occurs in an operation, the minimum value of the operand type is returned. Otherwise, the operation result is returned.
Parameters:
- y: Int16: multiplier
Returns:
- Int16: multiplication operation result
func saturatingNeg()
public func saturatingNeg(): Int16
Description: Performs negation operation using the saturation policy.
When an overflow occurs in an operation, the maximum value of the operand type is returned. When an underflow occurs in an operation, the minimum value of the operand type is returned. Otherwise, the operation result is returned.
Returns:
- Int16: negation operation result
func saturatingShl(Int16)
public func saturatingShl(y: Int16): Int16
Description: Performs left shift operation using the saturation policy.
When the number of bits to shift by is greater than or equal to that of operand bits, the number of bits to shift by is set to the number of operand bits minus 1. When the number of bits to shift by is less than 0, it is set to 0. Otherwise, the operation result is returned.
Parameters:
- y: Int16: number of bits to shift by
Returns:
- Int16: left shift operation result
func saturatingShr(Int16)
public func saturatingShr(y: Int16): Int16
Description: Performs right shift operation using the saturation policy.
When the number of bits to shift by is greater than or equal to that of operand bits, the number of bits to shift by is set to the number of operand bits minus 1. When the number of bits to shift by is less than 0, it is set to 0. Otherwise, the operation result is returned.
Parameters:
- y: Int16: number of bits to shift by
Returns:
- Int16: right shift operation result
func saturatingSub(Int16)
public func saturatingSub(y: Int16): Int16
Description: Performs subtraction operation using the saturation policy.
When an overflow occurs in an operation, the maximum value of the operand type is returned. When an underflow occurs in an operation, the minimum value of the operand type is returned. Otherwise, the operation result is returned.
Parameters:
- y: Int16: subtrahend
Returns:
- Int16: subtraction operation result
extend Int32 <: SaturatingOp<Int32>
extend Int32 <: SaturatingOp<Int32>
Description: Implements the SaturatingOp interface for Int32.
Parent Type:
func saturatingAdd(Int32)
public func saturatingAdd(y: Int32): Int32
Description: Performs addition operation using the saturation policy.
When an overflow occurs in an operation, the maximum value of the operand type is returned. When an underflow occurs in an operation, the minimum value of the operand type is returned. Otherwise, the operation result is returned.
Parameters:
- y: Int32: addend
Returns:
- Int32: addition operation result
func saturatingDec()
public func saturatingDec(): Int32
Description: Performs auto-decrement operation using the saturation policy.
When an underflow occurs in an operation, the minimum value of the operand type is returned. Otherwise, the operation result is returned.
Returns:
- Int32: auto-decrement operation result
func saturatingDiv(Int32)
public func saturatingDiv(y: Int32): Int32
Description: Performs division operation using the saturation policy.
When an overflow occurs in an operation, the maximum value of the operand type is returned. Otherwise, the operation result is returned.
Parameters:
- y: Int32: divisor
Returns:
- Int32: division operation result
func saturatingInc()
public func saturatingInc(): Int32
Description: Performs auto-increment operation using the saturation policy.
When an overflow occurs in an operation, the maximum value of the operand type is returned. Otherwise, the operation result is returned.
Returns:
- Int32: auto-increment operation result
func saturatingMod(Int32)
public func saturatingMod(y: Int32): Int32
Description: Performs modulo operation using the saturation policy.
When an overflow occurs in an operation, the maximum value of the operand type is returned. Otherwise, the operation result is returned.
Parameters:
- y: Int32: divisor
Returns:
- Int32: modulo operation result
func saturatingMul(Int32)
public func saturatingMul(y: Int32): Int32
Description: Performs multiplication operation using the saturation policy.
When an overflow occurs in an operation, the maximum value of the operand type is returned. When an underflow occurs in an operation, the minimum value of the operand type is returned. Otherwise, the operation result is returned.
Parameters:
- y: Int32: multiplier
Returns:
- Int32: multiplication operation result
func saturatingNeg()
public func saturatingNeg(): Int32
Description: Performs negation operation using the saturation policy.
When an overflow occurs in an operation, the maximum value of the operand type is returned. When an underflow occurs in an operation, the minimum value of the operand type is returned. Otherwise, the operation result is returned.
Returns:
- Int32: negation operation result
func saturatingShl(Int32)
public func saturatingShl(y: Int32): Int32
Description: Performs left shift operation using the saturation policy.
When the number of bits to shift by is greater than or equal to that of operand bits, the number of bits to shift by is set to the number of operand bits minus 1. When the number of bits to shift by is less than 0, it is set to 0. Otherwise, the operation result is returned.
Parameters:
- y: Int32: number of bits to shift by
Returns:
- Int32: left shift operation result
func saturatingShr(Int32)
public func saturatingShr(y: Int32): Int32
Description: Performs right shift operation using the saturation policy.
When the number of bits to shift by is greater than or equal to that of operand bits, the number of bits to shift by is set to the number of operand bits minus 1. When the number of bits to shift by is less than 0, it is set to 0. Otherwise, the operation result is returned.
Parameters:
- y: Int32: number of bits to shift by
Returns:
- Int32: right shift operation result
func saturatingSub(Int32)
public func saturatingSub(y: Int32): Int32
Description: Performs subtraction operation using the saturation policy.
When an overflow occurs in an operation, the maximum value of the operand type is returned. When an underflow occurs in an operation, the minimum value of the operand type is returned. Otherwise, the operation result is returned.
Parameters:
- y: Int32: subtrahend
Returns:
- Int32: subtraction operation result
extend Int64 <: SaturatingOp<Int64>
extend Int64 <: SaturatingOp<Int64>
Description: Implements the SaturatingOp interface for Int64.
Parent Type:
func saturatingAdd(Int64)
public func saturatingAdd(y: Int64): Int64
Description: Performs addition operation using the saturation policy.
When an overflow occurs in an operation, the maximum value of the operand type is returned. When an underflow occurs in an operation, the minimum value of the operand type is returned. Otherwise, the operation result is returned.
Parameters:
- y: Int64: addend
Returns:
- Int64: addition operation result
func saturatingDec()
public func saturatingDec(): Int64
Description: Performs auto-decrement operation using the saturation policy.
When an underflow occurs in an operation, the minimum value of the operand type is returned. Otherwise, the operation result is returned.
Returns:
- Int64: auto-decrement operation result
func saturatingDiv(Int64)
public func saturatingDiv(y: Int64): Int64
Description: Performs division operation using the saturation policy.
When an overflow occurs in an operation, the maximum value of the operand type is returned. Otherwise, the operation result is returned.
Parameters:
- y: Int64: divisor
Returns:
- Int64: division operation result
func saturatingInc()
public func saturatingInc(): Int64
Description: Performs auto-increment operation using the saturation policy.
When an overflow occurs in an operation, the maximum value of the operand type is returned. Otherwise, the operation result is returned.
Returns:
- Int64: auto-increment operation result
func saturatingMod(Int64)
public func saturatingMod(y: Int64): Int64
Description: Performs modulo operation using the saturation policy.
When an overflow occurs in an operation, the maximum value of the operand type is returned. Otherwise, the operation result is returned.
Parameters:
- y: Int64: divisor
Returns:
- Int64: modulo operation result
func saturatingMul(Int64)
public func saturatingMul(y: Int64): Int64
Description: Performs multiplication operation using the saturation policy.
When an overflow occurs in an operation, the maximum value of the operand type is returned. When an underflow occurs in an operation, the minimum value of the operand type is returned. Otherwise, the operation result is returned.
Parameters:
- y: Int64: multiplier
Returns:
- Int64: multiplication operation result
func saturatingNeg()
public func saturatingNeg(): Int64
Description: Performs negation operation using the saturation policy.
When an overflow occurs in an operation, the maximum value of the operand type is returned. When an underflow occurs in an operation, the minimum value of the operand type is returned. Otherwise, the operation result is returned.
Returns:
- Int64: negation operation result
func saturatingPow(UInt64)
public func saturatingPow(y: UInt64): Int64
Description: Performs exponentiation operation using the saturation policy.
When an overflow occurs in an operation, the maximum value of the operand type is returned. When an underflow occurs in an operation, the minimum value of the operand type is returned. Otherwise, the operation result is returned.
Parameters:
- y: UInt64: exponent
Returns:
- Int64: exponentiation operation result
func saturatingShl(Int64)
public func saturatingShl(y: Int64): Int64
Description: Performs left shift operation using the saturation policy.
When the number of bits to shift by is greater than or equal to that of operand bits, the number of bits to shift by is set to the number of operand bits minus 1. When the number of bits to shift by is less than 0, it is set to 0. Otherwise, the operation result is returned.
Parameters:
- y: Int64: number of bits to shift by
Returns:
- Int64: left shift operation result
func saturatingShr(Int64)
public func saturatingShr(y: Int64): Int64
Description: Performs right shift operation using the saturation policy.
When the number of bits to shift by is greater than or equal to that of operand bits, the number of bits to shift by is set to the number of operand bits minus 1. When the number of bits to shift by is less than 0, it is set to 0. Otherwise, the operation result is returned.
Parameters:
- y: Int64: number of bits to shift by
Returns:
- Int64: right shift operation result
func saturatingSub(Int64)
public func saturatingSub(y: Int64): Int64
Description: Performs subtraction operation using the saturation policy.
When an overflow occurs in an operation, the maximum value of the operand type is returned. When an underflow occurs in an operation, the minimum value of the operand type is returned. Otherwise, the operation result is returned.
Parameters:
- y: Int64: subtrahend
Returns:
- Int64: subtraction operation result
extend Int8 <: SaturatingOp<Int8>
extend Int8 <: SaturatingOp<Int8>
Description: Implements the SaturatingOp interface for Int8.
Parent Type:
func saturatingAdd(Int8)
public func saturatingAdd(y: Int8): Int8
Description: Performs addition operation using the saturation policy.
When an overflow occurs in an operation, the maximum value of the operand type is returned. When an underflow occurs in an operation, the minimum value of the operand type is returned. Otherwise, the operation result is returned.
Parameters:
- y: Int8: addend
Returns:
- Int8: addition operation result
func saturatingDec()
public func saturatingDec(): Int8
Description: Performs auto-decrement operation using the saturation policy.
When an underflow occurs in an operation, the minimum value of the operand type is returned. Otherwise, the operation result is returned.
Returns:
- Int8: auto-decrement operation result
func saturatingDiv(Int8)
public func saturatingDiv(y: Int8): Int8
Description: Performs division operation using the saturation policy.
When an overflow occurs in an operation, the maximum value of the operand type is returned. Otherwise, the operation result is returned.
Parameters:
- y: Int8: divisor
Returns:
- Int8: division operation result
func saturatingInc()
public func saturatingInc(): Int8
Description: Performs auto-increment operation using the saturation policy.
When an overflow occurs in an operation, the maximum value of the operand type is returned. Otherwise, the operation result is returned.
Returns:
- Int8: auto-increment operation result
func saturatingMod(Int8)
public func saturatingMod(y: Int8): Int8
Description: Performs modulo operation using the saturation policy.
When an overflow occurs in an operation, the maximum value of the operand type is returned. Otherwise, the operation result is returned.
Parameters:
- y: Int8: divisor
Returns:
- Int8: modulo operation result
func saturatingMul(Int8)
public func saturatingMul(y: Int8): Int8
Description: Performs multiplication operation using the saturation policy.
When an overflow occurs in an operation, the maximum value of the operand type is returned. When an underflow occurs in an operation, the minimum value of the operand type is returned. Otherwise, the operation result is returned.
Parameters:
- y: Int8: multiplier
Returns:
- Int8: multiplication operation result
func saturatingNeg()
public func saturatingNeg(): Int8
Description: Performs negation operation using the saturation policy.
When an overflow occurs in an operation, the maximum value of the operand type is returned. When an underflow occurs in an operation, the minimum value of the operand type is returned. Otherwise, the operation result is returned.
Returns:
- Int8: negation operation result
func saturatingShl(Int8)
public func saturatingShl(y: Int8): Int8
Description: Performs left shift operation using the saturation policy.
When the number of bits to shift by is greater than or equal to that of operand bits, the number of bits to shift by is set to the number of operand bits minus 1. When the number of bits to shift by is less than 0, it is set to 0. Otherwise, the operation result is returned.
Parameters:
- y: Int8: number of bits to shift by
Returns:
- Int8: left shift operation result
func saturatingShr(Int8)
public func saturatingShr(y: Int8): Int8
Description: Performs right shift operation using the saturation policy.
When the number of bits to shift by is greater than or equal to that of operand bits, the number of bits to shift by is set to the number of operand bits minus 1. When the number of bits to shift by is less than 0, it is set to 0. Otherwise, the operation result is returned.
Parameters:
- y: Int8: number of bits to shift by
Returns:
- Int8: right shift operation result
func saturatingSub(Int8)
public func saturatingSub(y: Int8): Int8
Description: Performs subtraction operation using the saturation policy.
When an overflow occurs in an operation, the maximum value of the operand type is returned. When an underflow occurs in an operation, the minimum value of the operand type is returned. Otherwise, the operation result is returned.
Parameters:
- y: Int8: subtrahend
Returns:
- Int8: subtraction operation result
extend IntNative <: SaturatingOp<IntNative>
extend IntNative <: SaturatingOp<IntNative>
Description: Implements the SaturatingOp interface for IntNative.
Parent Type:
func saturatingAdd(IntNative)
public func saturatingAdd(y: IntNative): IntNative
Description: Performs addition operation using the saturation policy.
When an overflow occurs in an operation, the maximum value of the operand type is returned. When an underflow occurs in an operation, the minimum value of the operand type is returned. Otherwise, the operation result is returned.
Parameters:
- y: IntNative: addend
Returns:
- IntNative: addition operation result
func saturatingDec()
public func saturatingDec(): IntNative
Description: Performs auto-decrement operation using the saturation policy.
When an underflow occurs in an operation, the minimum value of the operand type is returned. Otherwise, the operation result is returned.
Returns:
- IntNative: auto-decrement operation result
func saturatingDiv(IntNative)
public func saturatingDiv(y: IntNative): IntNative
Description: Performs division operation using the saturation policy.
When an overflow occurs in an operation, the maximum value of the operand type is returned. Otherwise, the operation result is returned.
Parameters:
- y: IntNative: divisor
Returns:
- IntNative: division operation result
func saturatingInc()
public func saturatingInc(): IntNative
Description: Performs auto-increment operation using the saturation policy.
When an overflow occurs in an operation, the maximum value of the operand type is returned. Otherwise, the operation result is returned.
Returns:
- IntNative: auto-increment operation result
func saturatingMod(IntNative)
public func saturatingMod(y: IntNative): IntNative
Description: Performs modulo operation using the saturation policy.
When an overflow occurs in an operation, the maximum value of the operand type is returned. Otherwise, the operation result is returned.
Parameters:
- y: IntNative: divisor
Returns:
- IntNative: modulo operation result
func saturatingMul(IntNative)
public func saturatingMul(y: IntNative): IntNative
Description: Performs multiplication operation using the saturation policy.
When an overflow occurs in an operation, the maximum value of the operand type is returned. When an underflow occurs in an operation, the minimum value of the operand type is returned. Otherwise, the operation result is returned.
Parameters:
- y: IntNative: multiplier
Returns:
- IntNative: multiplication operation result
func saturatingNeg()
public func saturatingNeg(): IntNative
Description: Performs negation operation using the saturation policy.
When an overflow occurs in an operation, the maximum value of the operand type is returned. When an underflow occurs in an operation, the minimum value of the operand type is returned. Otherwise, the operation result is returned.
Returns:
- IntNative: negation operation result
func saturatingShl(IntNative)
public func saturatingShl(y: IntNative): IntNative
Description: Performs left shift operation using the saturation policy.
When the number of bits to shift by is greater than or equal to that of operand bits, the number of bits to shift by is set to the number of operand bits minus 1. When the number of bits to shift by is less than 0, it is set to 0. Otherwise, the operation result is returned.
Parameters:
- y: IntNative: number of bits to shift by
Returns:
- IntNative: left shift operation result
func saturatingShr(IntNative)
public func saturatingShr(y: IntNative): IntNative
Description: Performs right shift operation using the saturation policy.
When the number of bits to shift by is greater than or equal to that of operand bits, the number of bits to shift by is set to the number of operand bits minus 1. When the number of bits to shift by is less than 0, it is set to 0. Otherwise, the operation result is returned.
Parameters:
- y: IntNative: number of bits to shift by
Returns:
- IntNative: right shift operation result
func saturatingSub(IntNative)
public func saturatingSub(y: IntNative): IntNative
Description: Performs subtraction operation using the saturation policy.
When an overflow occurs in an operation, the maximum value of the operand type is returned. When an underflow occurs in an operation, the minimum value of the operand type is returned. Otherwise, the operation result is returned.
Parameters:
- y: IntNative: subtrahend
Returns:
- IntNative: subtraction operation result
extend UInt16 <: SaturatingOp<UInt16>
extend UInt16 <: SaturatingOp<UInt16>
Description: Implements the SaturatingOp interface for UInt16.
Parent Type:
func saturatingAdd(UInt16)
public func saturatingAdd(y: UInt16): UInt16
Description: Performs addition operation using the saturation policy.
When an overflow occurs in an operation, the maximum value of the operand type is returned. When an underflow occurs in an operation, the minimum value of the operand type is returned. Otherwise, the operation result is returned.
Parameters:
- y: UInt16: addend
Returns:
- UInt16: addition operation result
func saturatingDec()
public func saturatingDec(): UInt16
Description: Performs auto-decrement operation using the saturation policy.
When an underflow occurs in an operation, the minimum value of the operand type is returned. Otherwise, the operation result is returned.
Returns:
- UInt16: auto-decrement operation result
func saturatingDiv(UInt16)
public func saturatingDiv(y: UInt16): UInt16
Description: Performs division operation using the saturation policy.
When an overflow occurs in an operation, the maximum value of the operand type is returned. Otherwise, the operation result is returned.
Parameters:
- y: UInt16: divisor
Returns:
- UInt16: division operation result
func saturatingInc()
public func saturatingInc(): UInt16
Description: Performs auto-increment operation using the saturation policy.
When an overflow occurs in an operation, the maximum value of the operand type is returned. Otherwise, the operation result is returned.
Returns:
- UInt16: auto-increment operation result
func saturatingMod(UInt16)
public func saturatingMod(y: UInt16): UInt16
Description: Performs modulo operation using the saturation policy.
When an overflow occurs in an operation, the maximum value of the operand type is returned. Otherwise, the operation result is returned.
Parameters:
- y: UInt16: divisor
Returns:
- UInt16: modulo operation result
func saturatingMul(UInt16)
public func saturatingMul(y: UInt16): UInt16
Description: Performs multiplication operation using the saturation policy.
When an overflow occurs in an operation, the maximum value of the operand type is returned. When an underflow occurs in an operation, the minimum value of the operand type is returned. Otherwise, the operation result is returned.
Parameters:
- y: UInt16: multiplier
Returns:
- UInt16: multiplication operation result
func saturatingNeg()
public func saturatingNeg(): UInt16
Description: Performs negation operation using the saturation policy.
When an overflow occurs in an operation, the maximum value of the operand type is returned. When an underflow occurs in an operation, the minimum value of the operand type is returned. Otherwise, the operation result is returned.
Returns:
- UInt16: negation operation result
func saturatingShl(UInt16)
public func saturatingShl(y: UInt16): UInt16
Description: Performs left shift operation using the saturation policy.
When the number of bits to shift by is greater than or equal to that of operand bits, the number of bits to shift by is set to the number of operand bits minus 1. When the number of bits to shift by is less than 0, it is set to 0. Otherwise, the operation result is returned.
Parameters:
- y: UInt16: number of bits to shift by
Returns:
- UInt16: left shift operation result
func saturatingShr(UInt16)
public func saturatingShr(y: UInt16): UInt16
Description: Performs right shift operation using the saturation policy.
When the number of bits to shift by is greater than or equal to that of operand bits, the number of bits to shift by is set to the number of operand bits minus 1. When the number of bits to shift by is less than 0, it is set to 0. Otherwise, the operation result is returned.
Parameters:
- y: UInt16: number of bits to shift by
Returns:
- UInt16: right shift operation result
func saturatingSub(UInt16)
public func saturatingSub(y: UInt16): UInt16
Description: Performs subtraction operation using the saturation policy.
When an overflow occurs in an operation, the maximum value of the operand type is returned. When an underflow occurs in an operation, the minimum value of the operand type is returned. Otherwise, the operation result is returned.
Parameters:
- y: UInt16: subtrahend
Returns:
- UInt16: subtraction operation result
extend UInt32 <: SaturatingOp<UInt32>
extend UInt32 <: SaturatingOp<UInt32>
Description: Implements the SaturatingOp interface for UInt32.
Parent Type:
func saturatingAdd(UInt32)
public func saturatingAdd(y: UInt32): UInt32
Description: Performs addition operation using the saturation policy.
When an overflow occurs in an operation, the maximum value of the operand type is returned. When an underflow occurs in an operation, the minimum value of the operand type is returned. Otherwise, the operation result is returned.
Parameters:
- y: UInt32: addend
Returns:
- UInt32: addition operation result
func saturatingDec()
public func saturatingDec(): UInt32
Description: Performs auto-decrement operation using the saturation policy.
When an underflow occurs in an operation, the minimum value of the operand type is returned. Otherwise, the operation result is returned.
Returns:
- UInt32: auto-decrement operation result
func saturatingDiv(UInt32)
public func saturatingDiv(y: UInt32): UInt32
Description: Performs division operation using the saturation policy.
When an overflow occurs in an operation, the maximum value of the operand type is returned. Otherwise, the operation result is returned.
Parameters:
- y: UInt32: divisor
Returns:
- UInt32: division operation result
func saturatingInc()
public func saturatingInc(): UInt32
Description: Performs auto-increment operation using the saturation policy.
When an overflow occurs in an operation, the maximum value of the operand type is returned. Otherwise, the operation result is returned.
Returns:
- UInt32: auto-increment operation result
func saturatingMod(UInt32)
public func saturatingMod(y: UInt32): UInt32
Description: Performs modulo operation using the saturation policy.
When an overflow occurs in an operation, the maximum value of the operand type is returned. Otherwise, the operation result is returned.
Parameters:
- y: UInt32: divisor
Returns:
- UInt32: modulo operation result
func saturatingMul(UInt32)
public func saturatingMul(y: UInt32): UInt32
Description: Performs multiplication operation using the saturation policy.
When an overflow occurs in an operation, the maximum value of the operand type is returned. When an underflow occurs in an operation, the minimum value of the operand type is returned. Otherwise, the operation result is returned.
Parameters:
- y: UInt32: multiplier
Returns:
- UInt32: multiplication operation result
func saturatingNeg()
public func saturatingNeg(): UInt32
Description: Performs negation operation using the saturation policy.
When an overflow occurs in an operation, the maximum value of the operand type is returned. When an underflow occurs in an operation, the minimum value of the operand type is returned. Otherwise, the operation result is returned.
Returns:
- UInt32: negation operation result
func saturatingShl(UInt32)
public func saturatingShl(y: UInt32): UInt32
Description: Performs left shift operation using the saturation policy.
When the number of bits to shift by is greater than or equal to that of operand bits, the number of bits to shift by is set to the number of operand bits minus 1. When the number of bits to shift by is less than 0, it is set to 0. Otherwise, the operation result is returned.
Parameters:
- y: UInt32: number of bits to shift by
Returns:
- UInt32: left shift operation result
func saturatingShr(UInt32)
public func saturatingShr(y: UInt32): UInt32
Description: Performs right shift operation using the saturation policy.
When the number of bits to shift by is greater than or equal to that of operand bits, the number of bits to shift by is set to the number of operand bits minus 1. When the number of bits to shift by is less than 0, it is set to 0. Otherwise, the operation result is returned.
Parameters:
- y: UInt32: number of bits to shift by
Returns:
- UInt32: right shift operation result
func saturatingSub(UInt32)
public func saturatingSub(y: UInt32): UInt32
Description: Performs subtraction operation using the saturation policy.
When an overflow occurs in an operation, the maximum value of the operand type is returned. When an underflow occurs in an operation, the minimum value of the operand type is returned. Otherwise, the operation result is returned.
Parameters:
- y: UInt32: subtrahend
Returns:
- UInt32: subtraction operation result
extend UInt64 <: SaturatingOp<UInt64>
extend UInt64 <: SaturatingOp<UInt64>
Description: Implements the SaturatingOp interface for UInt64.
Parent Type:
func saturatingAdd(UInt64)
public func saturatingAdd(y: UInt64): UInt64
Description: Performs addition operation using the saturation policy.
When an overflow occurs in an operation, the maximum value of the operand type is returned. When an underflow occurs in an operation, the minimum value of the operand type is returned. Otherwise, the operation result is returned.
Parameters:
- y: UInt64: addend
Returns:
- UInt64: addition operation result
func saturatingDec()
public func saturatingDec(): UInt64
Description: Performs auto-decrement operation using the saturation policy.
When an underflow occurs in an operation, the minimum value of the operand type is returned. Otherwise, the operation result is returned.
Returns:
- UInt64: auto-decrement operation result
func saturatingDiv(UInt64)
public func saturatingDiv(y: UInt64): UInt64
Description: Performs division operation using the saturation policy.
When an overflow occurs in an operation, the maximum value of the operand type is returned. Otherwise, the operation result is returned.
Parameters:
- y: UInt64: divisor
Returns:
- UInt64: division operation result
func saturatingInc()
public func saturatingInc(): UInt64
Description: Performs auto-increment operation using the saturation policy.
When an overflow occurs in an operation, the maximum value of the operand type is returned. Otherwise, the operation result is returned.
Returns:
- UInt64: auto-increment operation result
func saturatingMod(UInt64)
public func saturatingMod(y: UInt64): UInt64
Description: Performs modulo operation using the saturation policy.
When an overflow occurs in an operation, the maximum value of the operand type is returned. Otherwise, the operation result is returned.
Parameters:
- y: UInt64: divisor
Returns:
- UInt64: modulo operation result
func saturatingMul(UInt64)
public func saturatingMul(y: UInt64): UInt64
Description: Performs multiplication operation using the saturation policy.
When an overflow occurs in an operation, the maximum value of the operand type is returned. When an underflow occurs in an operation, the minimum value of the operand type is returned. Otherwise, the operation result is returned.
Parameters:
- y: UInt64: multiplier
Returns:
- UInt64: multiplication operation result
func saturatingNeg()
public func saturatingNeg(): UInt64
Description: Performs negation operation using the saturation policy.
When an overflow occurs in an operation, the maximum value of the operand type is returned. When an underflow occurs in an operation, the minimum value of the operand type is returned. Otherwise, the operation result is returned.
Returns:
- UInt64: negation operation result
func saturatingShl(UInt64)
public func saturatingShl(y: UInt64): UInt64
Description: Performs left shift operation using the saturation policy.
When the number of bits to shift by is greater than or equal to that of operand bits, the number of bits to shift by is set to the number of operand bits minus 1. When the number of bits to shift by is less than 0, it is set to 0. Otherwise, the operation result is returned.
Parameters:
- y: UInt64: number of bits to shift by
Returns:
- UInt64: left shift operation result
func saturatingShr(UInt64)
public func saturatingShr(y: UInt64): UInt64
Description: Performs right shift operation using the saturation policy.
When the number of bits to shift by is greater than or equal to that of operand bits, the number of bits to shift by is set to the number of operand bits minus 1. When the number of bits to shift by is less than 0, it is set to 0. Otherwise, the operation result is returned.
Parameters:
- y: UInt64: number of bits to shift by
Returns:
- UInt64: right shift operation result
func saturatingSub(UInt64)
public func saturatingSub(y: UInt64): UInt64
Description: Performs subtraction operation using the saturation policy.
When an overflow occurs in an operation, the maximum value of the operand type is returned. When an underflow occurs in an operation, the minimum value of the operand type is returned. Otherwise, the operation result is returned.
Parameters:
- y: UInt64: subtrahend
Returns:
- UInt64: subtraction operation result
extend UInt8 <: SaturatingOp<UInt8>
extend UInt8 <: SaturatingOp<UInt8>
Description: Implements the SaturatingOp interface for UInt8.
Parent Type:
func saturatingAdd(UInt8)
public func saturatingAdd(y: UInt8): UInt8
Description: Performs addition operation using the saturation policy.
When an overflow occurs in an operation, the maximum value of the operand type is returned. When an underflow occurs in an operation, the minimum value of the operand type is returned. Otherwise, the operation result is returned.
Parameters:
- y: UInt8: addend
Returns:
- UInt8: addition operation result
func saturatingDec()
public func saturatingDec(): UInt8
Description: Performs auto-decrement operation using the saturation policy.
When an underflow occurs in an operation, the minimum value of the operand type is returned. Otherwise, the operation result is returned.
Returns:
- UInt8: auto-decrement operation result
func saturatingDiv(UInt8)
public func saturatingDiv(y: UInt8): UInt8
Description: Performs division operation using the saturation policy.
When an overflow occurs in an operation, the maximum value of the operand type is returned. Otherwise, the operation result is returned.
Parameters:
- y: UInt8: divisor
Returns:
- UInt8: division operation result
func saturatingInc()
public func saturatingInc(): UInt8
Description: Performs auto-increment operation using the saturation policy.
When an overflow occurs in an operation, the maximum value of the operand type is returned. Otherwise, the operation result is returned.
Returns:
- UInt8: auto-increment operation result
func saturatingMod(UInt8)
public func saturatingMod(y: UInt8): UInt8
Description: Performs modulo operation using the saturation policy.
When an overflow occurs in an operation, the maximum value of the operand type is returned. Otherwise, the operation result is returned.
Parameters:
- y: UInt8: divisor
Returns:
- UInt8: modulo operation result
func saturatingMul(UInt8)
public func saturatingMul(y: UInt8): UInt8
Description: Performs multiplication operation using the saturation policy.
When an overflow occurs in an operation, the maximum value of the operand type is returned. When an underflow occurs in an operation, the minimum value of the operand type is returned. Otherwise, the operation result is returned.
Parameters:
- y: UInt8: multiplier
Returns:
- UInt8: multiplication operation result
func saturatingNeg()
public func saturatingNeg(): UInt8
Description: Performs negation operation using the saturation policy.
When an overflow occurs in an operation, the maximum value of the operand type is returned. When an underflow occurs in an operation, the minimum value of the operand type is returned. Otherwise, the operation result is returned.
Returns:
- UInt8: negation operation result
func saturatingShl(UInt8)
public func saturatingShl(y: UInt8): UInt8
Description: Performs left shift operation using the saturation policy.
When the number of bits to shift by is greater than or equal to that of operand bits, the number of bits to shift by is set to the number of operand bits minus 1. When the number of bits to shift by is less than 0, it is set to 0. Otherwise, the operation result is returned.
Parameters:
- y: UInt8: number of bits to shift by
Returns:
- UInt8: left shift operation result
func saturatingShr(UInt8)
public func saturatingShr(y: UInt8): UInt8
Description: Performs right shift operation using the saturation policy.
When the number of bits to shift by is greater than or equal to that of operand bits, the number of bits to shift by is set to the number of operand bits minus 1. When the number of bits to shift by is less than 0, it is set to 0. Otherwise, the operation result is returned.
Parameters:
- y: UInt8: number of bits to shift by
Returns:
- UInt8: right shift operation result
func saturatingSub(UInt8)
public func saturatingSub(y: UInt8): UInt8
Description: Performs subtraction operation using the saturation policy.
When an overflow occurs in an operation, the maximum value of the operand type is returned. When an underflow occurs in an operation, the minimum value of the operand type is returned. Otherwise, the operation result is returned.
Parameters:
- y: UInt8: subtrahend
Returns:
- UInt8: subtraction operation result
extend UIntNative <: SaturatingOp<UIntNative>
extend UIntNative <: SaturatingOp<UIntNative>
Description: Implements the SaturatingOp interface for UIntNative.
Parent Type:
func saturatingAdd(UIntNative)
public func saturatingAdd(y: UIntNative): UIntNative
Description: Performs addition operation using the saturation policy.
When an overflow occurs in an operation, the maximum value of the operand type is returned. When an underflow occurs in an operation, the minimum value of the operand type is returned. Otherwise, the operation result is returned.
Parameters:
- y: UIntNative: addend
Returns:
- UIntNative: addition operation result
func saturatingDec()
public func saturatingDec(): UIntNative
Description: Performs auto-decrement operation using the saturation policy.
When an underflow occurs in an operation, the minimum value of the operand type is returned. Otherwise, the operation result is returned.
Returns:
- UIntNative: auto-decrement operation result
func saturatingDiv(UIntNative)
public func saturatingDiv(y: UIntNative): UIntNative
Description: Performs division operation using the saturation policy.
When an overflow occurs in an operation, the maximum value of the operand type is returned. Otherwise, the operation result is returned.
Parameters:
- y: UIntNative: divisor
Returns:
- UIntNative: division operation result
func saturatingInc()
public func saturatingInc(): UIntNative
Description: Performs auto-increment operation using the saturation policy.
When an overflow occurs in an operation, the maximum value of the operand type is returned. Otherwise, the operation result is returned.
Returns:
- UIntNative: auto-increment operation result
func saturatingMod(UIntNative)
public func saturatingMod(y: UIntNative): UIntNative
Description: Performs modulo operation using the saturation policy.
When an overflow occurs in an operation, the maximum value of the operand type is returned. Otherwise, the operation result is returned.
Parameters:
- y: UIntNative: divisor
Returns:
- UIntNative: modulo operation result
func saturatingMul(UIntNative)
public func saturatingMul(y: UIntNative): UIntNative
Description: Performs multiplication operation using the saturation policy.
When an overflow occurs in an operation, the maximum value of the operand type is returned. When an underflow occurs in an operation, the minimum value of the operand type is returned. Otherwise, the operation result is returned.
Parameters:
- y: UIntNative: multiplier
Returns:
- UIntNative: multiplication operation result
func saturatingNeg()
public func saturatingNeg(): UIntNative
Description: Performs negation operation using the saturation policy.
When an overflow occurs in an operation, the maximum value of the operand type is returned. When an underflow occurs in an operation, the minimum value of the operand type is returned. Otherwise, the operation result is returned.
Returns:
- UIntNative: negation operation result
func saturatingShl(UIntNative)
public func saturatingShl(y: UIntNative): UIntNative
Description: Performs left shift operation using the saturation policy.
When the number of bits to shift by is greater than or equal to that of operand bits, the number of bits to shift by is set to the number of operand bits minus 1. When the number of bits to shift by is less than 0, it is set to 0. Otherwise, the operation result is returned.
Parameters:
- y: UIntNative: number of bits to shift by
Returns:
- UIntNative: left shift operation result
func saturatingShr(UIntNative)
public func saturatingShr(y: UIntNative): UIntNative
Description: Performs right shift operation using the saturation policy.
When the number of bits to shift by is greater than or equal to that of operand bits, the number of bits to shift by is set to the number of operand bits minus 1. When the number of bits to shift by is less than 0, it is set to 0. Otherwise, the operation result is returned.
Parameters:
- y: UIntNative: number of bits to shift by
Returns:
- UIntNative: right shift operation result
func saturatingSub(UIntNative)
public func saturatingSub(y: UIntNative): UIntNative
Description: Performs subtraction operation using the saturation policy.
When an overflow occurs in an operation, the maximum value of the operand type is returned. When an underflow occurs in an operation, the minimum value of the operand type is returned. Otherwise, the operation result is returned.
Parameters:
- y: UIntNative: subtrahend
Returns:
- UIntNative: subtraction operation result
interface ThrowingOp<T>
public interface ThrowingOp<T> {
func throwingAdd(y: T): T
func throwingDec(): T
func throwingDiv(y: T): T
func throwingInc(): T
func throwingMod(y: T): T
func throwingMul(y: T): T
func throwingNeg(): T
func throwingShl(y: T): T
func throwingShr(y: T): T
func throwingSub(y: T): T
}
Description: Throws an exception when an overflow occurs in an integer operation.
func throwingAdd(T)
func throwingAdd(y: T): T
Description: Performs addition operation using the exception throwing policy.
When an overflow occurs in an operation, an exception is thrown. Otherwise, the operation result is returned.
Parameters:
- y: T: addend
Returns:
- T: addition operation result
Throws:
- OverflowException: When an overflow occurs in the addition operation, this exception is thrown.
func throwingDec()
func throwingDec(): T
Description: Performs auto-decrement operation using the exception throwing policy.
When an overflow occurs in an operation, an exception is thrown. Otherwise, the operation result is returned.
Returns:
- T: auto-decrement operation result
Throws:
- OverflowException: When an overflow occurs in the auto-decrement operation, this exception is thrown.
func throwingDiv(T)
func throwingDiv(y: T): T
Description: Performs division operation using the exception throwing policy.
When an overflow occurs in an operation, an exception is thrown. Otherwise, the operation result is returned.
Parameters:
- y: T: divisor
Returns:
- T: division operation result
Throws:
- OverflowException: When an overflow occurs in the division operation, this exception is thrown.
func throwingInc()
func throwingInc(): T
Description: Performs auto-increment operation using the exception throwing policy.
When an overflow occurs in an operation, an exception is thrown. Otherwise, the operation result is returned.
Returns:
- T: auto-increment operation result
Throws:
- OverflowException: When an overflow occurs in the auto-increment operation, this exception is thrown.
func throwingMod(T)
func throwingMod(y: T): T
Description: Performs modulo operation using the exception throwing policy.
When an overflow occurs in an operation, an exception is thrown. Otherwise, the operation result is returned.
Parameters:
- y: T: divisor
Returns:
- T: modulo operation result
Throws:
- OverflowException: When an overflow occurs in the modulo operation, this exception is thrown.
func throwingMul(T)
func throwingMul(y: T): T
Description: Performs multiplication operation using the exception throwing policy.
When an overflow occurs in an operation, an exception is thrown. Otherwise, the operation result is returned.
Parameters:
- y: T: multiplier
Returns:
- T: multiplication operation result
Throws:
- OverflowException: When an overflow occurs in the multiplication operation, this exception is thrown.
func throwingNeg()
func throwingNeg(): T
Description: Performs negation operation using the exception throwing policy.
When an overflow occurs in an operation, an exception is thrown. Otherwise, the operation result is returned.
Returns:
- T: negation operation result
Throws:
- OverflowException: When an overflow occurs in the negation operation, this exception is thrown.
func throwingShl(T)
func throwingShl(y: T): T
Description: Performs left shift operation using the exception throwing policy.
When the number of bits to shift by is greater than or equal to that of operand bits or is less than 0, an exception is thrown. Otherwise, the operation result is returned.
Parameters:
- y: T: number of bits to shift by
Returns:
- T: left shift operation result
Throws:
- OvershiftException: When the number of bits to shift by is greater than or equal to that of operand bits, this exception is thrown.
- UndershiftException: When the number of bits to shift by is less than 0, this exception is thrown.
func throwingShr(T)
func throwingShr(y: T): T
Description: Performs right shift operation.
When the number of bits to shift by is greater than or equal to that of operand bits, an exception is thrown. Otherwise, the operation result is returned.
Parameters:
- y: T: number of bits to shift by
Returns:
- T: right shift operation result
Throws:
- OvershiftException: When the number of bits to shift by is greater than or equal to that of operand bits, this exception is thrown.
- UndershiftException: When the number of bits to shift by is less than 0, this exception is thrown.
func throwingSub(T)
func throwingSub(y: T): T
Description: Performs subtraction operation using the exception throwing policy.
When an overflow occurs in an operation, an exception is thrown. Otherwise, the operation result is returned.
Parameters:
- y: T: subtrahend
Returns:
- T: subtraction operation result
Throws:
- OverflowException: When an overflow occurs in the subtraction operation, this exception is thrown.
extend Int16 <: ThrowingOp<Int16>
extend Int16 <: ThrowingOp<Int16>
Description: Implements the ThrowingOp interface for Int16.
Parent Type:
func throwingAdd(Int16)
public func throwingAdd(y: Int16): Int16
Description: Performs addition operation using the exception throwing policy.
When an overflow occurs in an operation, an exception is thrown. Otherwise, the operation result is returned.
Parameters:
- y: Int16: addend
Returns:
- Int16: addition operation result
Throws:
- OverflowException: When an overflow occurs in the addition operation, this exception is thrown.
func throwingDec()
public func throwingDec(): Int16
Description: Performs auto-decrement operation using the exception throwing policy.
When an overflow occurs in an operation, an exception is thrown. Otherwise, the operation result is returned.
Returns:
- Int16: auto-decrement operation result
Throws:
- OverflowException: When an overflow occurs in the auto-decrement operation, this exception is thrown.
func throwingDiv(Int16)
public func throwingDiv(y: Int16): Int16
Description: Performs division operation using the exception throwing policy.
When an overflow occurs in an operation, an exception is thrown. Otherwise, the operation result is returned.
Parameters:
- y: Int16: divisor
Returns:
- Int16: division operation result
Throws:
- OverflowException: When an overflow occurs in the division operation, this exception is thrown.
func throwingInc()
public func throwingInc(): Int16
Description: Performs auto-increment operation using the exception throwing policy.
When an overflow occurs in an operation, an exception is thrown. Otherwise, the operation result is returned.
Returns:
- Int16: auto-increment operation result
Throws:
- OverflowException: When an overflow occurs in the auto-increment operation, this exception is thrown.
func throwingMod(Int16)
public func throwingMod(y: Int16): Int16
Description: Performs modulo operation using the exception throwing policy.
When an overflow occurs in an operation, an exception is thrown. Otherwise, the operation result is returned.
Parameters:
- y: Int16: divisor
Returns:
- Int16: modulo operation result
Throws:
- OverflowException: When an overflow occurs in the modulo operation, this exception is thrown.
func throwingMul(Int16)
public func throwingMul(y: Int16): Int16
Description: Performs multiplication operation using the exception throwing policy.
When an overflow occurs in an operation, an exception is thrown. Otherwise, the operation result is returned.
Parameters:
- y: Int16: multiplier
Returns:
- Int16: multiplication operation result
Throws:
- OverflowException: When an overflow occurs in the multiplication operation, this exception is thrown.
func throwingNeg()
public func throwingNeg(): Int16
Description: Performs negation operation using the exception throwing policy.
When an overflow occurs in an operation, an exception is thrown. Otherwise, the operation result is returned.
Returns:
- Int16: negation operation result
Throws:
- OverflowException: When an overflow occurs in the negation operation, this exception is thrown.
func throwingShl(Int16)
public func throwingShl(y: Int16): Int16
Description: Performs left shift operation using the exception throwing policy.
When the number of bits to shift by is greater than or equal to that of operand bits or is less than 0, an exception is thrown. Otherwise, the operation result is returned.
Parameters:
- y: Int16: number of bits to shift by
Returns:
- Int16: left shift operation result
Throws:
- OvershiftException: When the number of bits to shift by is greater than or equal to that of operand bits, this exception is thrown.
- UndershiftException: When the number of bits to shift by is less than 0, this exception is thrown.
func throwingShr(Int16)
public func throwingShr(y: Int16): Int16
Description: Performs right shift operation.
When the number of bits to shift by is greater than or equal to that of operand bits, an exception is thrown. Otherwise, the operation result is returned.
Parameters:
- y: Int16: number of bits to shift by
Returns:
- Int16: right shift operation result
Throws:
- OvershiftException: When the number of bits to shift by is greater than or equal to that of operand bits, this exception is thrown.
- UndershiftException: When the number of bits to shift by is less than 0, this exception is thrown.
func throwingSub(Int16)
public func throwingSub(y: Int16): Int16
Description: Performs subtraction operation using the exception throwing policy.
When an overflow occurs in an operation, an exception is thrown. Otherwise, the operation result is returned.
Parameters:
- y: Int16: subtrahend
Returns:
- Int16: subtraction operation result
Throws:
- OverflowException: When an overflow occurs in the subtraction operation, this exception is thrown.
extend Int32 <: ThrowingOp<Int32>
extend Int32 <: ThrowingOp<Int32>
Description: Implements the ThrowingOp interface for Int32.
Parent Type:
func throwingAdd(Int32)
public func throwingAdd(y: Int32): Int32
Description: Performs addition operation using the exception throwing policy.
When an overflow occurs in an operation, an exception is thrown. Otherwise, the operation result is returned.
Parameters:
- y: Int32: addend
Returns:
- Int32: addition operation result
Throws:
- OverflowException: When an overflow occurs in the addition operation, this exception is thrown.
func throwingDec()
public func throwingDec(): Int32
Description: Performs auto-decrement operation using the exception throwing policy.
When an overflow occurs in an operation, an exception is thrown. Otherwise, the operation result is returned.
Returns:
- Int32: auto-decrement operation result
Throws:
- OverflowException: When an overflow occurs in the auto-decrement operation, this exception is thrown.
func throwingDiv(Int32)
public func throwingDiv(y: Int32): Int32
Description: Performs division operation using the exception throwing policy.
When an overflow occurs in an operation, an exception is thrown. Otherwise, the operation result is returned.
Parameters:
- y: Int32: divisor
Returns:
- Int32: division operation result
Throws:
- OverflowException: When an overflow occurs in the division operation, this exception is thrown.
func throwingInc()
public func throwingInc(): Int32
Description: Performs auto-increment operation using the exception throwing policy.
When an overflow occurs in an operation, an exception is thrown. Otherwise, the operation result is returned.
Returns:
- Int32: auto-increment operation result
Throws:
- OverflowException: When an overflow occurs in the auto-increment operation, this exception is thrown.
func throwingMod(Int32)
public func throwingMod(y: Int32): Int32
Description: Performs modulo operation using the exception throwing policy.
When an overflow occurs in an operation, an exception is thrown. Otherwise, the operation result is returned.
Parameters:
- y: Int32: divisor
Returns:
- Int32: modulo operation result
Throws:
- OverflowException: When an overflow occurs in the modulo operation, this exception is thrown.
func throwingMul(Int32)
public func throwingMul(y: Int32): Int32
Description: Performs multiplication operation using the exception throwing policy.
When an overflow occurs in an operation, an exception is thrown. Otherwise, the operation result is returned.
Parameters:
- y: Int32: multiplier
Returns:
- Int32: multiplication operation result
Throws:
- OverflowException: When an overflow occurs in the multiplication operation, this exception is thrown.
func throwingNeg()
public func throwingNeg(): Int32
Description: Performs negation operation using the exception throwing policy.
When an overflow occurs in an operation, an exception is thrown. Otherwise, the operation result is returned.
Returns:
- Int32: negation operation result
Throws:
- OverflowException: When an overflow occurs in the negation operation, this exception is thrown.
func throwingShl(Int32)
public func throwingShl(y: Int32): Int32
Description: Performs left shift operation using the exception throwing policy.
When the number of bits to shift by is greater than or equal to that of operand bits or is less than 0, an exception is thrown. Otherwise, the operation result is returned.
Parameters:
- y: Int32: number of bits to shift by
Returns:
- Int32: left shift operation result
Throws:
- OvershiftException: When the number of bits to shift by is greater than or equal to that of operand bits, this exception is thrown.
- UndershiftException: When the number of bits to shift by is less than 0, this exception is thrown.
func throwingShr(Int32)
public func throwingShr(y: Int32): Int32
Description: Performs right shift operation.
When the number of bits to shift by is greater than or equal to that of operand bits, an exception is thrown. Otherwise, the operation result is returned.
Parameters:
- y: Int32: number of bits to shift by
Returns:
- Int32: right shift operation result
Throws:
- OvershiftException: When the number of bits to shift by is greater than or equal to that of operand bits, this exception is thrown.
- UndershiftException: When the number of bits to shift by is less than 0, this exception is thrown.
func throwingSub(Int32)
public func throwingSub(y: Int32): Int32
Description: Performs subtraction operation using the exception throwing policy.
When an overflow occurs in an operation, an exception is thrown. Otherwise, the operation result is returned.
Parameters:
- y: Int32: subtrahend
Returns:
- Int32: subtraction operation result
Throws:
- OverflowException: When an overflow occurs in the subtraction operation, this exception is thrown.
extend Int64 <: ThrowingOp
extend Int64 <: ThrowingOp<Int64>
Description: Implements the ThrowingOp interface for Int64.
Parent Type:
func throwingAdd(Int64)
public func throwingAdd(y: Int64): Int64
Description: Performs addition operation using the exception throwing policy.
When an overflow occurs in an operation, an exception is thrown. Otherwise, the operation result is returned.
Parameters:
- y: Int64: addend
Returns:
- Int64: addition operation result
Throws:
- OverflowException: When an overflow occurs in the addition operation, this exception is thrown.
func throwingDec()
public func throwingDec(): Int64
Description: Performs auto-decrement operation using the exception throwing policy.
When an overflow occurs in an operation, an exception is thrown. Otherwise, the operation result is returned.
Returns:
- Int64: auto-decrement operation result
Throws:
- OverflowException: When an overflow occurs in the auto-decrement operation, this exception is thrown.
func throwingDiv(Int64)
public func throwingDiv(y: Int64): Int64
Description: Performs division operation using the exception throwing policy.
When an overflow occurs in an operation, an exception is thrown. Otherwise, the operation result is returned.
Parameters:
- y: Int64: divisor
Returns:
- Int64: division operation result
Throws:
- OverflowException: When an overflow occurs in the division operation, this exception is thrown.
func throwingInc()
public func throwingInc(): Int64
Description: Performs auto-increment operation using the exception throwing policy.
When an overflow occurs in an operation, an exception is thrown. Otherwise, the operation result is returned.
Returns:
- Int64: auto-increment operation result
Throws:
- OverflowException: When an overflow occurs in the auto-increment operation, this exception is thrown.
func throwingMod(Int64)
public func throwingMod(y: Int64): Int64
Description: Performs modulo operation using the exception throwing policy.
When an overflow occurs in an operation, an exception is thrown. Otherwise, the operation result is returned.
Parameters:
- y: Int64: divisor
Returns:
- Int64: modulo operation result
Throws:
- OverflowException: When an overflow occurs in the modulo operation, this exception is thrown.
func throwingMul(Int64)
public func throwingMul(y: Int64): Int64
Description: Performs multiplication operation using the exception throwing policy.
When an overflow occurs in an operation, an exception is thrown. Otherwise, the operation result is returned.
Parameters:
- y: Int64: multiplier
Returns:
- Int64: multiplication operation result
Throws:
- OverflowException: When an overflow occurs in the multiplication operation, this exception is thrown.
func throwingNeg()
public func throwingNeg(): Int64
Description: Performs negation operation using the exception throwing policy.
When an overflow occurs in an operation, an exception is thrown. Otherwise, the operation result is returned.
Returns:
- Int64: negation operation result
Throws:
- OverflowException: When an overflow occurs in the negation operation, this exception is thrown.
func throwingPow(UInt64)
public func throwingPow(y: UInt64): Int64
Description: Performs exponentiation operation using the exception throwing policy.
When an overflow occurs in an operation, an exception is thrown. Otherwise, the operation result is returned.
Parameters:
- y: UInt64: exponent
Returns:
- Int64: exponentiation operation result
Throws:
- OverflowException: When an overflow occurs in the exponentiation operation, this exception is thrown.
func throwingShl(Int64)
public func throwingShl(y: Int64): Int64
Description: Performs left shift operation using the exception throwing policy.
When the number of bits to shift by is greater than or equal to that of operand bits or is less than 0, an exception is thrown. Otherwise, the operation result is returned.
Parameters:
- y: Int64: number of bits to shift by
Returns:
- Int64: left shift operation result
Throws:
- OvershiftException: When the number of bits to shift by is greater than or equal to that of operand bits, this exception is thrown.
- UndershiftException: When the number of bits to shift by is less than 0, this exception is thrown.
func throwingShr(Int64)
public func throwingShr(y: Int64): Int64
Description: Performs right shift operation.
When the number of bits to shift by is greater than or equal to that of operand bits, an exception is thrown. Otherwise, the operation result is returned.
Parameters:
- y: Int64: number of bits to shift by
Returns:
- Int64: right shift operation result
Throws:
- OvershiftException: When the number of bits to shift by is greater than or equal to that of operand bits, this exception is thrown.
- UndershiftException: When the number of bits to shift by is less than 0, this exception is thrown.
func throwingSub(Int64)
public func throwingSub(y: Int64): Int64
Description: Performs subtraction operation using the exception throwing policy.
When an overflow occurs in an operation, an exception is thrown. Otherwise, the operation result is returned.
Parameters:
- y: Int64: subtrahend
Returns:
- Int64: subtraction operation result
Throws:
- OverflowException: When an overflow occurs in the subtraction operation, this exception is thrown.
extend Int8 <: ThrowingOp<Int8>
extend Int8 <: ThrowingOp<Int8>
Description: Implements the ThrowingOp interface for Int8.
Parent Type:
func throwingAdd(Int8)
public func throwingAdd(y: Int8): Int8
Description: Performs addition operation using the exception throwing policy.
When an overflow occurs in an operation, an exception is thrown. Otherwise, the operation result is returned.
Parameters:
- y: Int8: addend
Returns:
- Int8: addition operation result
Throws:
- OverflowException: When an overflow occurs in the addition operation, this exception is thrown.
func throwingDec()
public func throwingDec(): Int8
Description: Performs auto-decrement operation using the exception throwing policy.
When an overflow occurs in an operation, an exception is thrown. Otherwise, the operation result is returned.
Returns:
- Int8: auto-decrement operation result
Throws:
- OverflowException: When an overflow occurs in the auto-decrement operation, this exception is thrown.
func throwingDiv(Int8)
public func throwingDiv(y: Int8): Int8
Description: Performs division operation using the exception throwing policy.
When an overflow occurs in an operation, an exception is thrown. Otherwise, the operation result is returned.
Parameters:
- y: Int8: divisor
Returns:
- Int8: division operation result
Throws:
- OverflowException: When an overflow occurs in the division operation, this exception is thrown.
func throwingInc()
public func throwingInc(): Int8
Description: Performs auto-increment operation using the exception throwing policy.
When an overflow occurs in an operation, an exception is thrown. Otherwise, the operation result is returned.
Returns:
- Int8: auto-increment operation result
Throws:
- OverflowException: When an overflow occurs in the auto-increment operation, this exception is thrown.
func throwingMod(Int8)
public func throwingMod(y: Int8): Int8
Description: Performs modulo operation using the exception throwing policy.
When an overflow occurs in an operation, an exception is thrown. Otherwise, the operation result is returned.
Parameters:
- y: Int8: divisor
Returns:
- Int8: modulo operation result
Throws:
- OverflowException: When an overflow occurs in the modulo operation, this exception is thrown.
func throwingMul(Int8)
public func throwingMul(y: Int8): Int8
Description: Performs multiplication operation using the exception throwing policy.
When an overflow occurs in an operation, an exception is thrown. Otherwise, the operation result is returned.
Parameters:
- y: Int8: multiplier
Returns:
- Int8: multiplication operation result
Throws:
- OverflowException: When an overflow occurs in the multiplication operation, this exception is thrown.
func throwingNeg()
public func throwingNeg(): Int8
Description: Performs negation operation using the exception throwing policy.
When an overflow occurs in an operation, an exception is thrown. Otherwise, the operation result is returned.
Returns:
- Int8: negation operation result
Throws:
- OverflowException: When an overflow occurs in the negation operation, this exception is thrown.
func throwingShl(Int8)
public func throwingShl(y: Int8): Int8
Description: Performs left shift operation using the exception throwing policy.
When the number of bits to shift by is greater than or equal to that of operand bits or is less than 0, an exception is thrown. Otherwise, the operation result is returned.
Parameters:
- y: Int8: number of bits to shift by
Returns:
- Int8: left shift operation result
Throws:
- OvershiftException: When the number of bits to shift by is greater than or equal to that of operand bits, this exception is thrown.
- UndershiftException: When the number of bits to shift by is less than 0, this exception is thrown.
func throwingShr(Int8)
public func throwingShr(y: Int8): Int8
Description: Performs right shift operation.
When the number of bits to shift by is greater than or equal to that of operand bits, an exception is thrown. Otherwise, the operation result is returned.
Parameters:
- y: Int8: number of bits to shift by
Returns:
- Int8: right shift operation result
Throws:
- OvershiftException: When the number of bits to shift by is greater than or equal to that of operand bits, this exception is thrown.
- UndershiftException: When the number of bits to shift by is less than 0, this exception is thrown.
func throwingSub(Int8)
public func throwingSub(y: Int8): Int8
Description: Performs subtraction operation using the exception throwing policy.
When an overflow occurs in an operation, an exception is thrown. Otherwise, the operation result is returned.
Parameters:
- y: Int8: subtrahend
Returns:
- Int8: subtraction operation result
Throws:
- OverflowException: When an overflow occurs in the subtraction operation, this exception is thrown.
extend IntNative <: ThrowingOp<IntNative>
extend IntNative <: ThrowingOp<IntNative>
Description: Implements the ThrowingOp interface for IntNative.
Parent Type:
func throwingAdd(IntNative)
public func throwingAdd(y: IntNative): IntNative
Description: Performs addition operation using the exception throwing policy.
When an overflow occurs in an operation, an exception is thrown. Otherwise, the operation result is returned.
Parameters:
- y: IntNative: addend
Returns:
- IntNative: addition operation result
Throws:
- OverflowException: When an overflow occurs in the addition operation, this exception is thrown.
func throwingDec()
public func throwingDec(): IntNative
Description: Performs auto-decrement operation using the exception throwing policy.
When an overflow occurs in an operation, an exception is thrown. Otherwise, the operation result is returned.
Returns:
- IntNative: auto-decrement operation result
Throws:
- OverflowException: When an overflow occurs in the auto-decrement operation, this exception is thrown.
func throwingDiv(IntNative)
public func throwingDiv(y: IntNative): IntNative
Description: Performs division operation using the exception throwing policy.
When an overflow occurs in an operation, an exception is thrown. Otherwise, the operation result is returned.
Parameters:
- y: IntNative: divisor
Returns:
- IntNative: division operation result
Throws:
- OverflowException: When an overflow occurs in the division operation, this exception is thrown.
func throwingInc()
public func throwingInc(): IntNative
Description: Performs auto-increment operation using the exception throwing policy.
When an overflow occurs in an operation, an exception is thrown. Otherwise, the operation result is returned.
Returns:
- IntNative: auto-increment operation result
Throws:
- OverflowException: When an overflow occurs in the auto-increment operation, this exception is thrown.
func throwingMod(IntNative)
public func throwingMod(y: IntNative): IntNative
Description: Performs modulo operation using the exception throwing policy.
When an overflow occurs in an operation, an exception is thrown. Otherwise, the operation result is returned.
Parameters:
- y: IntNative: divisor
Returns:
- IntNative: modulo operation result
Throws:
- OverflowException: When an overflow occurs in the modulo operation, this exception is thrown.
func throwingMul(IntNative)
public func throwingMul(y: IntNative): IntNative
Description: Performs multiplication operation using the exception throwing policy.
When an overflow occurs in an operation, an exception is thrown. Otherwise, the operation result is returned.
Parameters:
- y: IntNative: multiplier
Returns:
- IntNative: multiplication operation result
Throws:
- OverflowException: When an overflow occurs in the multiplication operation, this exception is thrown.
func throwingNeg()
public func throwingNeg(): IntNative
Description: Performs negation operation using the exception throwing policy.
When an overflow occurs in an operation, an exception is thrown. Otherwise, the operation result is returned.
Returns:
- IntNative: negation operation result
Throws:
- OverflowException: When an overflow occurs in the negation operation, this exception is thrown.
func throwingShl(IntNative)
public func throwingShl(y: IntNative): IntNative
Description: Performs left shift operation using the exception throwing policy.
When the number of bits to shift by is greater than or equal to that of operand bits or is less than 0, an exception is thrown. Otherwise, the operation result is returned.
Parameters:
- y: IntNative: number of bits to shift by
Returns:
- IntNative: left shift operation result
Throws:
- OvershiftException: When the number of bits to shift by is greater than or equal to that of operand bits, this exception is thrown.
- UndershiftException: When the number of bits to shift by is less than 0, this exception is thrown.
func throwingShr(IntNative)
public func throwingShr(y: IntNative): IntNative
Description: Performs right shift operation.
When the number of bits to shift by is greater than or equal to that of operand bits, an exception is thrown. Otherwise, the operation result is returned.
Parameters:
- y: IntNative: number of bits to shift by
Returns:
- IntNative: right shift operation result
Throws:
- OvershiftException: When the number of bits to shift by is greater than or equal to that of operand bits, this exception is thrown.
- UndershiftException: When the number of bits to shift by is less than 0, this exception is thrown.
func throwingSub(IntNative)
public func throwingSub(y: IntNative): IntNative
Description: Performs subtraction operation using the exception throwing policy.
When an overflow occurs in an operation, an exception is thrown. Otherwise, the operation result is returned.
Parameters:
- y: IntNative: subtrahend
Returns:
- IntNative: subtraction operation result
Throws:
- OverflowException: When an overflow occurs in the subtraction operation, this exception is thrown.
extend UInt16 <: ThrowingOp<UInt16>
extend UInt16 <: ThrowingOp<UInt16>
Description: Implements the ThrowingOp interface for UInt16.
Parent Type:
func throwingAdd(UInt16)
public func throwingAdd(y: UInt16): UInt16
Description: Performs addition operation using the exception throwing policy.
When an overflow occurs in an operation, an exception is thrown. Otherwise, the operation result is returned.
Parameters:
- y: UInt16: addend
Returns:
- UInt16: addition operation result
Throws:
- OverflowException: When an overflow occurs in the addition operation, this exception is thrown.
func throwingDec()
public func throwingDec(): UInt16
Description: Performs auto-decrement operation using the exception throwing policy.
When an overflow occurs in an operation, an exception is thrown. Otherwise, the operation result is returned.
Returns:
- UInt16: auto-decrement operation result
Throws:
- OverflowException: When an overflow occurs in the auto-decrement operation, this exception is thrown.
func throwingDiv(UInt16)
public func throwingDiv(y: UInt16): UInt16
Description: Performs division operation using the exception throwing policy.
When an overflow occurs in an operation, an exception is thrown. Otherwise, the operation result is returned.
Parameters:
- y: UInt16: divisor
Returns:
- UInt16: division operation result
Throws:
- OverflowException: When an overflow occurs in the division operation, this exception is thrown.
func throwingInc()
public func throwingInc(): UInt16
Description: Performs auto-increment operation using the exception throwing policy.
When an overflow occurs in an operation, an exception is thrown. Otherwise, the operation result is returned.
Returns:
- UInt16: auto-increment operation result
Throws:
- OverflowException: When an overflow occurs in the auto-increment operation, this exception is thrown.
func throwingMod(UInt16)
public func throwingMod(y: UInt16): UInt16
Description: Performs modulo operation using the exception throwing policy.
When an overflow occurs in an operation, an exception is thrown. Otherwise, the operation result is returned.
Parameters:
- y: UInt16: divisor
Returns:
- UInt16: modulo operation result
Throws:
- OverflowException: When an overflow occurs in the modulo operation, this exception is thrown.
func throwingMul(UInt16)
public func throwingMul(y: UInt16): UInt16
Description: Performs multiplication operation using the exception throwing policy.
When an overflow occurs in an operation, an exception is thrown. Otherwise, the operation result is returned.
Parameters:
- y: UInt16: multiplier
Returns:
- UInt16: multiplication operation result
Throws:
- OverflowException: When an overflow occurs in the multiplication operation, this exception is thrown.
func throwingNeg()
public func throwingNeg(): UInt16
Description: Performs negation operation using the exception throwing policy.
When an overflow occurs in an operation, an exception is thrown. Otherwise, the operation result is returned.
Returns:
- UInt16: negation operation result
Throws:
- OverflowException: When an overflow occurs in the negation operation, this exception is thrown.
func throwingShl(UInt16)
public func throwingShl(y: UInt16): UInt16
Description: Performs left shift operation using the exception throwing policy.
When the number of bits to shift by is greater than or equal to that of operand bits or is less than 0, an exception is thrown. Otherwise, the operation result is returned.
Parameters:
- y: UInt16: number of bits to shift by
Returns:
- UInt16: left shift operation result
Throws:
- OvershiftException: When the number of bits to shift by is greater than or equal to that of operand bits, this exception is thrown.
func throwingShr(UInt16)
public func throwingShr(y: UInt16): UInt16
Description: Performs right shift operation.
When the number of bits to shift by is greater than or equal to that of operand bits, an exception is thrown. Otherwise, the operation result is returned.
Parameters:
- y: UInt16: number of bits to shift by
Returns:
- UInt16: right shift operation result
Throws:
- OvershiftException: When the number of bits to shift by is greater than or equal to that of operand bits, this exception is thrown.
func throwingSub(UInt16)
public func throwingSub(y: UInt16): UInt16
Description: Performs subtraction operation using the exception throwing policy.
When an overflow occurs in an operation, an exception is thrown. Otherwise, the operation result is returned.
Parameters:
- y: UInt16: subtrahend
Returns:
- UInt16: subtraction operation result
Throws:
- OverflowException: When an overflow occurs in the subtraction operation, this exception is thrown.
extend UInt32 <: ThrowingOp<UInt32>
extend UInt32 <: ThrowingOp<UInt32>
Description: Implements the ThrowingOp interface for UInt32.
Parent Type:
func throwingAdd(UInt32)
public func throwingAdd(y: UInt32): UInt32
Description: Performs addition operation using the exception throwing policy.
When an overflow occurs in an operation, an exception is thrown. Otherwise, the operation result is returned.
Parameters:
- y: UInt32: addend
Returns:
- UInt32: addition operation result
Throws:
- OverflowException: When an overflow occurs in the addition operation, this exception is thrown.
func throwingDec()
public func throwingDec(): UInt32
Description: Performs auto-decrement operation using the exception throwing policy.
When an overflow occurs in an operation, an exception is thrown. Otherwise, the operation result is returned.
Returns:
- UInt32: auto-decrement operation result
Throws:
- OverflowException: When an overflow occurs in the auto-decrement operation, this exception is thrown.
func throwingDiv(UInt32)
public func throwingDiv(y: UInt32): UInt32
Description: Performs division operation using the exception throwing policy.
When an overflow occurs in an operation, an exception is thrown. Otherwise, the operation result is returned.
Parameters:
- y: UInt32: divisor
Returns:
- UInt32: division operation result
Throws:
- OverflowException: When an overflow occurs in the division operation, this exception is thrown.
func throwingInc()
public func throwingInc(): UInt32
Description: Performs auto-increment operation using the exception throwing policy.
When an overflow occurs in an operation, an exception is thrown. Otherwise, the operation result is returned.
Returns:
- UInt32: auto-increment operation result
Throws:
- OverflowException: When an overflow occurs in the auto-increment operation, this exception is thrown.
func throwingMod(UInt32)
public func throwingMod(y: UInt32): UInt32
Description: Performs modulo operation using the exception throwing policy.
When an overflow occurs in an operation, an exception is thrown. Otherwise, the operation result is returned.
Parameters:
- y: UInt32: divisor
Returns:
- UInt32: modulo operation result
Throws:
- OverflowException: When an overflow occurs in the modulo operation, this exception is thrown.
func throwingMul(UInt32)
public func throwingMul(y: UInt32): UInt32
Description: Performs multiplication operation using the exception throwing policy.
When an overflow occurs in an operation, an exception is thrown. Otherwise, the operation result is returned.
Parameters:
- y: UInt32: multiplier
Returns:
- UInt32: multiplication operation result
Throws:
- OverflowException: When an overflow occurs in the multiplication operation, this exception is thrown.
func throwingNeg()
public func throwingNeg(): UInt32
Description: Performs negation operation using the exception throwing policy.
When an overflow occurs in an operation, an exception is thrown. Otherwise, the operation result is returned.
Returns:
- UInt32: negation operation result
Throws:
- OverflowException: When an overflow occurs in the negation operation, this exception is thrown.
func throwingShl(UInt32)
public func throwingShl(y: UInt32): UInt32
Description: Performs left shift operation using the exception throwing policy.
When the number of bits to shift by is greater than or equal to that of operand bits or is less than 0, an exception is thrown. Otherwise, the operation result is returned.
Parameters:
- y: UInt32: number of bits to shift by
Returns:
- UInt32: left shift operation result
Throws:
- OvershiftException: When the number of bits to shift by is greater than or equal to that of operand bits, this exception is thrown.
func throwingShr(UInt32)
public func throwingShr(y: UInt32): UInt32
Description: Performs right shift operation.
When the number of bits to shift by is greater than or equal to that of operand bits, an exception is thrown. Otherwise, the operation result is returned.
Parameters:
- y: UInt32: number of bits to shift by
Returns:
- UInt32: right shift operation result
Throws:
- OvershiftException: When the number of bits to shift by is greater than or equal to that of operand bits, this exception is thrown.
func throwingSub(UInt32)
public func throwingSub(y: UInt32): UInt32
Description: Performs subtraction operation using the exception throwing policy.
When an overflow occurs in an operation, an exception is thrown. Otherwise, the operation result is returned.
Parameters:
- y: UInt32: subtrahend
Returns:
- UInt32: subtraction operation result
Throws:
- OverflowException: When an overflow occurs in the subtraction operation, this exception is thrown.
extend UInt64 <: ThrowingOp<UInt64>
extend UInt64 <: ThrowingOp<UInt64>
Description: Implements the ThrowingOp interface for UInt64.
Parent Type:
func throwingAdd(UInt64)
public func throwingAdd(y: UInt64): UInt64
Description: Performs addition operation using the exception throwing policy.
When an overflow occurs in an operation, an exception is thrown. Otherwise, the operation result is returned.
Parameters:
- y: UInt64: addend
Returns:
- UInt64: addition operation result
Throws:
- OverflowException: When an overflow occurs in the addition operation, this exception is thrown.
func throwingDec()
public func throwingDec(): UInt64
Description: Performs auto-decrement operation using the exception throwing policy.
When an overflow occurs in an operation, an exception is thrown. Otherwise, the operation result is returned.
Returns:
- UInt64: auto-decrement operation result
Throws:
- OverflowException: When an overflow occurs in the auto-decrement operation, this exception is thrown.
func throwingDiv(UInt64)
public func throwingDiv(y: UInt64): UInt64
Description: Performs division operation using the exception throwing policy.
When an overflow occurs in an operation, an exception is thrown. Otherwise, the operation result is returned.
Parameters:
- y: UInt64: divisor
Returns:
- UInt64: division operation result
Throws:
- OverflowException: When an overflow occurs in the division operation, this exception is thrown.
func throwingInc()
public func throwingInc(): UInt64
Description: Performs auto-increment operation using the exception throwing policy.
When an overflow occurs in an operation, an exception is thrown. Otherwise, the operation result is returned.
Returns:
- UInt64: auto-increment operation result
Throws:
- OverflowException: When an overflow occurs in the auto-increment operation, this exception is thrown.
func throwingMod(UInt64)
public func throwingMod(y: UInt64): UInt64
Description: Performs modulo operation using the exception throwing policy.
When an overflow occurs in an operation, an exception is thrown. Otherwise, the operation result is returned.
Parameters:
- y: UInt64: divisor
Returns:
- UInt64: modulo operation result
Throws:
- OverflowException: When an overflow occurs in the modulo operation, this exception is thrown.
func throwingMul(UInt64)
public func throwingMul(y: UInt64): UInt64
Description: Performs multiplication operation using the exception throwing policy.
When an overflow occurs in an operation, an exception is thrown. Otherwise, the operation result is returned.
Parameters:
- y: UInt64: multiplier
Returns:
- UInt64: multiplication operation result
Throws:
- OverflowException: When an overflow occurs in the multiplication operation, this exception is thrown.
func throwingNeg()
public func throwingNeg(): UInt64
Description: Performs negation operation using the exception throwing policy.
When an overflow occurs in an operation, an exception is thrown. Otherwise, the operation result is returned.
Returns:
- UInt64: negation operation result
Throws:
- OverflowException: When an overflow occurs in the negation operation, this exception is thrown.
func throwingShl(UInt64)
public func throwingShl(y: UInt64): UInt64
Description: Performs left shift operation using the exception throwing policy.
When the number of bits to shift by is greater than or equal to that of operand bits or is less than 0, an exception is thrown. Otherwise, the operation result is returned.
Parameters:
- y: UInt64: number of bits to shift by
Returns:
- UInt64: left shift operation result
Throws:
- OvershiftException: When the number of bits to shift by is greater than or equal to that of operand bits, this exception is thrown.
func throwingShr(UInt64)
public func throwingShr(y: UInt64): UInt64
Description: Performs right shift operation.
When the number of bits to shift by is greater than or equal to that of operand bits, an exception is thrown. Otherwise, the operation result is returned.
Parameters:
- y: UInt64: number of bits to shift by
Returns:
- UInt64: right shift operation result
Throws:
- OvershiftException: When the number of bits to shift by is greater than or equal to that of operand bits, this exception is thrown.
func throwingSub(UInt64)
public func throwingSub(y: UInt64): UInt64
Description: Performs subtraction operation using the exception throwing policy.
When an overflow occurs in an operation, an exception is thrown. Otherwise, the operation result is returned.
Parameters:
- y: UInt64: subtrahend
Returns:
- UInt64: subtraction operation result
Throws:
- OverflowException: When an overflow occurs in the subtraction operation, this exception is thrown.
extend UInt8 <: ThrowingOp<UInt8>
extend UInt8 <: ThrowingOp<UInt8>
Description: Implements the ThrowingOp interface for UInt8.
Parent Type:
func throwingAdd(UInt8)
public func throwingAdd(y: UInt8): UInt8
Description: Performs addition operation using the exception throwing policy.
When an overflow occurs in an operation, an exception is thrown. Otherwise, the operation result is returned.
Parameters:
- y: UInt8: addend
Returns:
- UInt8: addition operation result
Throws:
- OverflowException: When an overflow occurs in the addition operation, this exception is thrown.
func throwingDec()
public func throwingDec(): UInt8
Description: Performs auto-decrement operation using the exception throwing policy.
When an overflow occurs in an operation, an exception is thrown. Otherwise, the operation result is returned.
Returns:
- UInt8: auto-decrement operation result
Throws:
- OverflowException: When an overflow occurs in the auto-decrement operation, this exception is thrown.
func throwingDiv(UInt8)
public func throwingDiv(y: UInt8): UInt8
Description: Performs division operation using the exception throwing policy.
When an overflow occurs in an operation, an exception is thrown. Otherwise, the operation result is returned.
Parameters:
- y: UInt8: divisor
Returns:
- UInt8: division operation result
Throws:
- OverflowException: When an overflow occurs in the division operation, this exception is thrown.
func throwingInc()
public func throwingInc(): UInt8
Description: Performs auto-increment operation using the exception throwing policy.
When an overflow occurs in an operation, an exception is thrown. Otherwise, the operation result is returned.
Returns:
- UInt8: auto-increment operation result
Throws:
- OverflowException: When an overflow occurs in the auto-increment operation, this exception is thrown.
func throwingMod(UInt8)
public func throwingMod(y: UInt8): UInt8
Description: Performs modulo operation using the exception throwing policy.
When an overflow occurs in an operation, an exception is thrown. Otherwise, the operation result is returned.
Parameters:
- y: UInt8: divisor
Returns:
- UInt8: modulo operation result
Throws:
- OverflowException: When an overflow occurs in the modulo operation, this exception is thrown.
func throwingMul(UInt8)
public func throwingMul(y: UInt8): UInt8
Description: Performs multiplication operation using the exception throwing policy.
When an overflow occurs in an operation, an exception is thrown. Otherwise, the operation result is returned.
Parameters:
- y: UInt8: multiplier
Returns:
- UInt8: multiplication operation result
Throws:
- OverflowException: When an overflow occurs in the multiplication operation, this exception is thrown.
func throwingNeg()
public func throwingNeg(): UInt8
Description: Performs negation operation using the exception throwing policy.
When an overflow occurs in an operation, an exception is thrown. Otherwise, the operation result is returned.
Returns:
- UInt8: negation operation result
Throws:
- OverflowException: When an overflow occurs in the negation operation, this exception is thrown.
func throwingShl(UInt8)
public func throwingShl(y: UInt8): UInt8
Description: Performs left shift operation using the exception throwing policy.
When the number of bits to shift by is greater than or equal to that of operand bits or is less than 0, an exception is thrown. Otherwise, the operation result is returned.
Parameters:
- y: UInt8: number of bits to shift by
Returns:
- UInt8: left shift operation result
Throws:
- OvershiftException: When the number of bits to shift by is greater than or equal to that of operand bits, this exception is thrown.
func throwingShr(UInt8)
public func throwingShr(y: UInt8): UInt8
Description: Performs right shift operation.
When the number of bits to shift by is greater than or equal to that of operand bits, an exception is thrown. Otherwise, the operation result is returned.
Parameters:
- y: UInt8: number of bits to shift by
Returns:
- UInt8: right shift operation result
Throws:
- OvershiftException: When the number of bits to shift by is greater than or equal to that of operand bits, this exception is thrown.
func throwingSub(UInt8)
public func throwingSub(y: UInt8): UInt8
Description: Performs subtraction operation using the exception throwing policy.
When an overflow occurs in an operation, an exception is thrown. Otherwise, the operation result is returned.
Parameters:
- y: UInt8: subtrahend
Returns:
- UInt8: subtraction operation result
Throws:
- OverflowException: When an overflow occurs in the subtraction operation, this exception is thrown.
extend UIntNative <: ThrowingOp<UIntNative>
extend UIntNative <: ThrowingOp<UIntNative>
Description: Implements the ThrowingOp interface for UIntNative.
Parent Type:
func throwingAdd(UIntNative)
public func throwingAdd(y: UIntNative): UIntNative
Description: Performs addition operation using the exception throwing policy.
When an overflow occurs in an operation, an exception is thrown. Otherwise, the operation result is returned.
Parameters:
- y: UIntNative: addend
Returns:
- UIntNative: addition operation result
Throws:
- OverflowException: When an overflow occurs in the addition operation, this exception is thrown.
func throwingDec()
public func throwingDec(): UIntNative
Description: Performs auto-decrement operation using the exception throwing policy.
When an overflow occurs in an operation, an exception is thrown. Otherwise, the operation result is returned.
Returns:
- UIntNative: auto-decrement operation result
Throws:
- OverflowException: When an overflow occurs in the auto-decrement operation, this exception is thrown.
func throwingDiv(UIntNative)
public func throwingDiv(y: UIntNative): UIntNative
Description: Performs division operation using the exception throwing policy.
When an overflow occurs in an operation, an exception is thrown. Otherwise, the operation result is returned.
Parameters:
- y: UIntNative: divisor
Returns:
- UIntNative: division operation result
Throws:
- OverflowException: When an overflow occurs in the division operation, this exception is thrown.
func throwingInc()
public func throwingInc(): UIntNative
Description: Performs auto-increment operation using the exception throwing policy.
When an overflow occurs in an operation, an exception is thrown. Otherwise, the operation result is returned.
Returns:
- UIntNative: auto-increment operation result
Throws:
- OverflowException: When an overflow occurs in the auto-increment operation, this exception is thrown.
func throwingMod(UIntNative)
public func throwingMod(y: UIntNative): UIntNative
Description: Performs modulo operation using the exception throwing policy.
When an overflow occurs in an operation, an exception is thrown. Otherwise, the operation result is returned.
Parameters:
- y: UIntNative: divisor
Returns:
- UIntNative: modulo operation result
Throws:
- OverflowException: When an overflow occurs in the modulo operation, this exception is thrown.
func throwingMul(UIntNative)
public func throwingMul(y: UIntNative): UIntNative
Description: Performs multiplication operation using the exception throwing policy.
When an overflow occurs in an operation, an exception is thrown. Otherwise, the operation result is returned.
Parameters:
- y: UIntNative: multiplier
Returns:
- UIntNative: multiplication operation result
Throws:
- OverflowException: When an overflow occurs in the multiplication operation, this exception is thrown.
func throwingNeg()
public func throwingNeg(): UIntNative
Description: Performs negation operation using the exception throwing policy.
When an overflow occurs in an operation, an exception is thrown. Otherwise, the operation result is returned.
Returns:
- UIntNative: negation operation result
Throws:
- OverflowException: When an overflow occurs in the negation operation, this exception is thrown.
func throwingShl(UIntNative)
public func throwingShl(y: UIntNative): UIntNative
Description: Performs left shift operation using the exception throwing policy.
When the number of bits to shift by is greater than or equal to that of operand bits or is less than 0, an exception is thrown. Otherwise, the operation result is returned.
Parameters:
- y: UIntNative: number of bits to shift by
Returns:
- UIntNative: left shift operation result
Throws:
- OvershiftException: When the number of bits to shift by is greater than or equal to that of operand bits, this exception is thrown.
func throwingShr(UIntNative)
public func throwingShr(y: UIntNative): UIntNative
Description: Performs right shift operation.
When the number of bits to shift by is greater than or equal to that of operand bits, an exception is thrown. Otherwise, the operation result is returned.
Parameters:
- y: UIntNative: number of bits to shift by
Returns:
- UIntNative: right shift operation result
Throws:
- OvershiftException: When the number of bits to shift by is greater than or equal to that of operand bits, this exception is thrown.
func throwingSub(UIntNative)
public func throwingSub(y: UIntNative): UIntNative
Description: Performs subtraction operation using the exception throwing policy.
When an overflow occurs in an operation, an exception is thrown. Otherwise, the operation result is returned.
Parameters:
- y: UIntNative: subtrahend
Returns:
- UIntNative: subtraction operation result
Throws:
- OverflowException: When an overflow occurs in the subtraction operation, this exception is thrown.
interface WrappingOp<T>
public interface WrappingOp<T> {
func wrappingAdd(y: T): T
func wrappingDec(): T
func wrappingDiv(y: T): T
func wrappingInc(): T
func wrappingMod(y: T): T
func wrappingMul(y: T): T
func wrappingNeg(): T
func wrappingShl(y: T): T
func wrappingShr(y: T): T
func wrappingSub(y: T): T
}
Description: Truncates the most significant bits when an overflow occurs in an integer operation.
func wrappingAdd(T)
func wrappingAdd(y: T): T
Description: Performs addition operation using the policy of truncating most significant bits.
When an overflow occurs in an operation, most significant bits are truncated. Otherwise, the operation result is returned.
Parameters:
- y: T: addend
Returns:
- T: addition operation result
func wrappingDec()
func wrappingDec(): T
Description: Performs auto-decrement operation using the policy of truncating most significant bits.
When an overflow occurs in an operation, most significant bits are truncated. Otherwise, the operation result is returned.
Returns:
- T: auto-decrement operation result
func wrappingDiv(T)
func wrappingDiv(y: T): T
Description: Performs division operation using the policy of truncating most significant bits.
When an overflow occurs in an operation, most significant bits are truncated. Otherwise, the operation result is returned.
Parameters:
- y: T: divisor
Returns:
- T: division operation result
func wrappingInc()
func wrappingInc(): T
Description: Performs auto-increment operation using the policy of truncating most significant bits.
When an overflow occurs in an operation, most significant bits are truncated. Otherwise, the operation result is returned.
Returns:
- T: auto-increment operation result
func wrappingMod(T)
func wrappingMod(y: T): T
Description: Performs modulo operation using the policy of truncating most significant bits.
When an overflow occurs in an operation, most significant bits are truncated. Otherwise, the operation result is returned.
Parameters:
- y: T: divisor
Returns:
- T: modulo operation result
func wrappingMul(T)
func wrappingMul(y: T): T
Description: Performs multiplication operation using the policy of truncating most significant bits.
When an overflow occurs in an operation, most significant bits are truncated. Otherwise, the operation result is returned.
Parameters:
- y: T: multiplier
Returns:
- T: multiplication operation result
func wrappingNeg()
func wrappingNeg(): T
Description: Performs negation operation using the policy of truncating most significant bits.
When an overflow occurs in an operation, most significant bits are truncated. Otherwise, the operation result is returned.
Returns:
- T: negation operation result
func wrappingShl(T)
func wrappingShl(y: T): T
Description: Performs left shift operation using the policy of truncating most significant bits.
When the number of bits to shift by is greater than or equal to that of operand bits or is less than 0, most significant bits are truncated. For example, to shift a number of the Int8 type, when y (the number of bits to shift by) is greater than or equal to 8, only its 3 least significant bits are used as the number of bits to shift by, ensuring that the number of bits to shift by ranges from 0 to 7.
Parameters:
- y: T: number of bits to shift by
Returns:
- T: left shift operation result
func wrappingShr(T)
func wrappingShr(y: T): T
Description: Performs right shift operation using the policy of truncating most significant bits.
When the number of bits to shift by is greater than or equal to that of operand bits or is less than 0, most significant bits are truncated. For example, to shift a number of the Int8 type, when y (the number of bits to shift by) is greater than or equal to 8, only its 3 least significant bits are used as the number of bits to shift by, ensuring that the number of bits to shift by ranges from 0 to 7.
Parameters:
- y: T: number of bits to shift by
Returns:
- T: right shift operation result
func wrappingSub(T)
func wrappingSub(y: T): T
Description: Performs subtraction operation using the policy of truncating most significant bits.
When an overflow occurs in an operation, most significant bits are truncated. Otherwise, the operation result is returned.
Parameters:
- y: T: subtrahend
Returns:
- T: subtraction operation result
extend Int16 <: WrappingOp<Int16>
extend Int16 <: WrappingOp<Int16>
Description: Implements the WrappingOp interface for Int16.
Parent Type:
func wrappingAdd(Int16)
public func wrappingAdd(y: Int16): Int16
Description: Performs addition operation using the policy of truncating most significant bits.
When an overflow occurs in an operation, most significant bits are truncated. Otherwise, the operation result is returned.
Parameters:
- y: Int16: addend
Returns:
- Int16: addition operation result
func wrappingDec()
public func wrappingDec(): Int16
Description: Performs auto-decrement operation using the policy of truncating most significant bits.
When an overflow occurs in an operation, most significant bits are truncated. Otherwise, the operation result is returned.
Returns:
- Int16: auto-decrement operation result
func wrappingDiv(Int16)
public func wrappingDiv(y: Int16): Int16
Description: Performs division operation using the policy of truncating most significant bits.
When an overflow occurs in an operation, most significant bits are truncated. Otherwise, the operation result is returned.
Parameters:
- y: Int16: divisor
Returns:
- Int16: division operation result
func wrappingInc()
public func wrappingInc(): Int16
Description: Performs auto-increment operation using the policy of truncating most significant bits.
When an overflow occurs in an operation, most significant bits are truncated. Otherwise, the operation result is returned.
Returns:
- Int16: auto-increment operation result
func wrappingMod(Int16)
public func wrappingMod(y: Int16): Int16
Description: Performs modulo operation using the policy of truncating most significant bits.
When an overflow occurs in an operation, most significant bits are truncated. Otherwise, the operation result is returned.
Parameters:
- y: Int16: divisor
Returns:
- Int16: modulo operation result
func wrappingMul(Int16)
public func wrappingMul(y: Int16): Int16
Description: Performs multiplication operation using the policy of truncating most significant bits.
When an overflow occurs in an operation, most significant bits are truncated. Otherwise, the operation result is returned.
Parameters:
- y: Int16: multiplier
Returns:
- Int16: multiplication operation result
func wrappingNeg()
public func wrappingNeg(): Int16
Description: Performs negation operation using the policy of truncating most significant bits.
When an overflow occurs in an operation, most significant bits are truncated. Otherwise, the operation result is returned.
Returns:
- Int16: negation operation result
func wrappingShl(Int16)
public func wrappingShl(y: Int16): Int16
Description: Performs left shift operation using the policy of truncating most significant bits.
When the number of bits of the right operand is greater than or equal to that of the left operand or is less than 0, the 4 least significant bits of the right operand are used as the number of bits to shift by.
Parameters:
- y: Int16: number of bits to shift by
Returns:
- Int16: left shift operation result
func wrappingShr(Int16)
public func wrappingShr(y: Int16): Int16
Description: Performs right shift operation using the policy of truncating most significant bits.
When the number of bits of the right operand is greater than or equal to that of the left operand or is less than 0, the 4 least significant bits of the right operand are used as the number of bits to shift by.
Parameters:
- y: Int16: number of bits to shift by
Returns:
- Int16: right shift operation result
func wrappingSub(Int16)
public func wrappingSub(y: Int16): Int16
Description: Performs subtraction operation using the policy of truncating most significant bits.
When an overflow occurs in an operation, most significant bits are truncated. Otherwise, the operation result is returned.
Parameters:
- y: Int16: subtrahend
Returns:
- Int16: subtraction operation result
extend Int32 <: WrappingOp<Int32>
extend Int32 <: WrappingOp<Int32>
Description: Implements the WrappingOp interface for Int32.
Parent Type:
func wrappingAdd(Int32)
public func wrappingAdd(y: Int32): Int32
Description: Performs addition operation using the policy of truncating most significant bits.
When an overflow occurs in an operation, most significant bits are truncated. Otherwise, the operation result is returned.
Parameters:
- y: Int32: addend
Returns:
- Int32: addition operation result
func wrappingDec()
public func wrappingDec(): Int32
Description: Performs auto-decrement operation using the policy of truncating most significant bits.
When an overflow occurs in an operation, most significant bits are truncated. Otherwise, the operation result is returned.
Returns:
- Int32: auto-decrement operation result
func wrappingDiv(Int32)
public func wrappingDiv(y: Int32): Int32
Description: Performs division operation using the policy of truncating most significant bits.
When an overflow occurs in an operation, most significant bits are truncated. Otherwise, the operation result is returned.
Parameters:
- y: Int32: divisor
Returns:
- Int32: division operation result
func wrappingInc()
public func wrappingInc(): Int32
Description: Performs auto-increment operation using the policy of truncating most significant bits.
When an overflow occurs in an operation, most significant bits are truncated. Otherwise, the operation result is returned.
Returns:
- Int32: auto-increment operation result
func wrappingMod(Int32)
public func wrappingMod(y: Int32): Int32
Description: Performs modulo operation using the policy of truncating most significant bits.
When an overflow occurs in an operation, most significant bits are truncated. Otherwise, the operation result is returned.
Parameters:
- y: Int32: divisor
Returns:
- Int32: modulo operation result
func wrappingMul(Int32)
public func wrappingMul(y: Int32): Int32
Description: Performs multiplication operation using the policy of truncating most significant bits.
When an overflow occurs in an operation, most significant bits are truncated. Otherwise, the operation result is returned.
Parameters:
- y: Int32: multiplier
Returns:
- Int32: multiplication operation result
func wrappingNeg()
public func wrappingNeg(): Int32
Description: Performs negation operation using the policy of truncating most significant bits.
When an overflow occurs in an operation, most significant bits are truncated. Otherwise, the operation result is returned.
Returns:
- Int32: negation operation result
func wrappingShl(Int32)
public func wrappingShl(y: Int32): Int32
Description: Performs left shift operation using the policy of truncating most significant bits.
When the number of bits of the right operand is greater than or equal to that of the left operand or is less than 0, the 5 least significant bits of the right operand are used as the number of bits to shift by.
Parameters:
- y: Int32: number of bits to shift by
Returns:
- Int32: left shift operation result
func wrappingShr(Int32)
public func wrappingShr(y: Int32): Int32
Description: Performs right shift operation using the policy of truncating most significant bits.
When the number of bits of the right operand is greater than or equal to that of the left operand or is less than 0, the 5 least significant bits of the right operand are used as the number of bits to shift by.
Parameters:
- y: Int32: number of bits to shift by
Returns:
- Int32: right shift operation result
func wrappingSub(Int32)
public func wrappingSub(y: Int32): Int32
Description: Performs subtraction operation using the policy of truncating most significant bits.
When an overflow occurs in an operation, most significant bits are truncated. Otherwise, the operation result is returned.
Parameters:
- y: Int32: subtrahend
Returns:
- Int32: subtraction operation result
extend Int64 <: WrappingOp<Int64>
extend Int64 <: WrappingOp<Int64>
Description: Implements the WrappingOp interface for Int64.
Parent Type:
func wrappingAdd(Int64)
public func wrappingAdd(y: Int64): Int64
Description: Performs addition operation using the policy of truncating most significant bits.
When an overflow occurs in an operation, most significant bits are truncated. Otherwise, the operation result is returned.
Parameters:
- y: Int64: addend
Returns:
- Int64: addition operation result
func wrappingDec()
public func wrappingDec(): Int64
Description: Performs auto-decrement operation using the policy of truncating most significant bits.
When an overflow occurs in an operation, most significant bits are truncated. Otherwise, the operation result is returned.
Returns:
- Int64: auto-decrement operation result
func wrappingDiv(Int64)
public func wrappingDiv(y: Int64): Int64
Description: Performs division operation using the policy of truncating most significant bits.
When an overflow occurs in an operation, most significant bits are truncated. Otherwise, the operation result is returned.
Parameters:
- y: Int64: divisor
Returns:
- Int64: division operation result
func wrappingInc()
public func wrappingInc(): Int64
Description: Performs auto-increment operation using the policy of truncating most significant bits.
When an overflow occurs in an operation, most significant bits are truncated. Otherwise, the operation result is returned.
Returns:
- Int64: auto-increment operation result
func wrappingMod(Int64)
public func wrappingMod(y: Int64): Int64
Description: Performs modulo operation using the policy of truncating most significant bits.
When an overflow occurs in an operation, most significant bits are truncated. Otherwise, the operation result is returned.
Parameters:
- y: Int64: divisor
Returns:
- Int64: modulo operation result
func wrappingMul(Int64)
public func wrappingMul(y: Int64): Int64
Description: Performs multiplication operation using the policy of truncating most significant bits.
When an overflow occurs in an operation, most significant bits are truncated. Otherwise, the operation result is returned.
Parameters:
- y: Int64: multiplier
Returns:
- Int64: multiplication operation result
func wrappingNeg()
public func wrappingNeg(): Int64
Description: Performs negation operation using the policy of truncating most significant bits.
When an overflow occurs in an operation, most significant bits are truncated. Otherwise, the operation result is returned.
Returns:
- Int64: negation operation result
func wrappingPow(UInt64)
public func wrappingPow(y: UInt64): Int64
Description: Performs exponentiation operation using the policy of truncating most significant bits.
When an overflow occurs in an operation, most significant bits are truncated. Otherwise, the operation result is returned.
Parameters:
- y: UInt64: exponent
Returns:
- Int64: exponentiation operation result
func wrappingShl(Int64)
public func wrappingShl(y: Int64): Int64
Description: Performs left shift operation using the policy of truncating most significant bits.
When the number of bits of the right operand is greater than or equal to that of the left operand or is less than 0, the 6 least significant bits of the right operand are used as the number of bits to shift by.
Parameters:
- y: Int64: number of bits to shift by
Returns:
- Int64: left shift operation result
func wrappingShr(Int64)
public func wrappingShr(y: Int64): Int64
Description: Performs right shift operation using the policy of truncating most significant bits.
When the number of bits of the right operand is greater than or equal to that of the left operand or is less than 0, the 6 least significant bits of the right operand are used as the number of bits to shift by.
Parameters:
- y: Int64: number of bits to shift by
Returns:
- Int64: right shift operation result
func wrappingSub(Int64)
public func wrappingSub(y: Int64): Int64
Description: Performs subtraction operation using the policy of truncating most significant bits.
When an overflow occurs in an operation, most significant bits are truncated. Otherwise, the operation result is returned.
Parameters:
- y: Int64: subtrahend
Returns:
- Int64: subtraction operation result
extend Int8 <: WrappingOp<Int8>
extend Int8 <: WrappingOp<Int8>
Description: Implements the WrappingOp interface for Int8.
Parent Type:
func wrappingAdd(Int8)
public func wrappingAdd(y: Int8): Int8
Description: Performs addition operation using the policy of truncating most significant bits.
When an overflow occurs in an operation, most significant bits are truncated. Otherwise, the operation result is returned.
Parameters:
- y: Int8: addend
Returns:
- Int8: addition operation result
func wrappingDec()
public func wrappingDec(): Int8
Description: Performs auto-decrement operation using the policy of truncating most significant bits.
When an overflow occurs in an operation, most significant bits are truncated. Otherwise, the operation result is returned.
Returns:
- Int8: auto-decrement operation result
func wrappingDiv(Int8)
public func wrappingDiv(y: Int8): Int8
Description: Performs division operation using the policy of truncating most significant bits.
When an overflow occurs in an operation, most significant bits are truncated. Otherwise, the operation result is returned.
Parameters:
- y: Int8: divisor
Returns:
- Int8: division operation result
func wrappingInc()
public func wrappingInc(): Int8
Description: Performs auto-increment operation using the policy of truncating most significant bits.
When an overflow occurs in an operation, most significant bits are truncated. Otherwise, the operation result is returned.
Returns:
- Int8: auto-increment operation result
func wrappingMod(Int8)
public func wrappingMod(y: Int8): Int8
Description: Performs modulo operation using the policy of truncating most significant bits.
When an overflow occurs in an operation, most significant bits are truncated. Otherwise, the operation result is returned.
Parameters:
- y: Int8: divisor
Returns:
- Int8: modulo operation result
func wrappingMul(Int8)
public func wrappingMul(y: Int8): Int8
Description: Performs multiplication operation using the policy of truncating most significant bits.
When an overflow occurs in an operation, most significant bits are truncated. Otherwise, the operation result is returned.
Parameters:
- y: Int8: multiplier
Returns:
- Int8: multiplication operation result
func wrappingNeg()
public func wrappingNeg(): Int8
Description: Performs negation operation using the policy of truncating most significant bits.
When an overflow occurs in an operation, most significant bits are truncated. Otherwise, the operation result is returned.
Returns:
- Int8: negation operation result
func wrappingShl(Int8)
public func wrappingShl(y: Int8): Int8
Description: Performs left shift operation using the policy of truncating most significant bits.
When the number of bits of the right operand is greater than or equal to that of the left operand or is less than 0, the 3 least significant bits of the right operand are used as the number of bits to shift by.
Parameters:
- y: Int8: number of bits to shift by
Returns:
- Int8: left shift operation result
func wrappingShr(Int8)
public func wrappingShr(y: Int8): Int8
Description: Performs right shift operation using the policy of truncating most significant bits.
When the number of bits of the right operand is greater than or equal to that of the left operand or is less than 0, the 3 least significant bits of the right operand are used as the number of bits to shift by.
Parameters:
- y: Int8: number of bits to shift by
Returns:
- Int8: right shift operation result
func wrappingSub(Int8)
public func wrappingSub(y: Int8): Int8
Description: Performs subtraction operation using the policy of truncating most significant bits.
When an overflow occurs in an operation, most significant bits are truncated. Otherwise, the operation result is returned.
Parameters:
- y: Int8: subtrahend
Returns:
- Int8: subtraction operation result
extend IntNative <: WrappingOp<IntNative>
extend IntNative <: WrappingOp<IntNative>
Description: Implements the WrappingOp interface for IntNative.
Parent Type:
func wrappingAdd(IntNative)
public func wrappingAdd(y: IntNative): IntNative
Description: Performs addition operation using the policy of truncating most significant bits.
When an overflow occurs in an operation, most significant bits are truncated. Otherwise, the operation result is returned.
Parameters:
- y: IntNative: addend
Returns:
- IntNative: addition operation result
func wrappingDec()
public func wrappingDec(): IntNative
Description: Performs auto-decrement operation using the policy of truncating most significant bits.
When an overflow occurs in an operation, most significant bits are truncated. Otherwise, the operation result is returned.
Returns:
- IntNative: auto-decrement operation result
func wrappingDiv(IntNative)
public func wrappingDiv(y: IntNative): IntNative
Description: Performs division operation using the policy of truncating most significant bits.
When an overflow occurs in an operation, most significant bits are truncated. Otherwise, the operation result is returned.
Parameters:
- y: IntNative: divisor
Returns:
- IntNative: division operation result
func wrappingInc()
public func wrappingInc(): IntNative
Description: Performs auto-increment operation using the policy of truncating most significant bits.
When an overflow occurs in an operation, most significant bits are truncated. Otherwise, the operation result is returned.
Returns:
- IntNative: auto-increment operation result
func wrappingMod(IntNative)
public func wrappingMod(y: IntNative): IntNative
Description: Performs modulo operation using the policy of truncating most significant bits.
When an overflow occurs in an operation, most significant bits are truncated. Otherwise, the operation result is returned.
Parameters:
- y: IntNative: divisor
Returns:
- IntNative: modulo operation result
func wrappingMul(IntNative)
public func wrappingMul(y: IntNative): IntNative
Description: Performs multiplication operation using the policy of truncating most significant bits.
When an overflow occurs in an operation, most significant bits are truncated. Otherwise, the operation result is returned.
Parameters:
- y: IntNative: multiplier
Returns:
- IntNative: multiplication operation result
func wrappingNeg()
public func wrappingNeg(): IntNative
Description: Performs negation operation using the policy of truncating most significant bits.
When an overflow occurs in an operation, most significant bits are truncated. Otherwise, the operation result is returned.
Returns:
- IntNative: negation operation result
func wrappingShl(IntNative)
public func wrappingShl(y: IntNative): IntNative
Description: Performs left shift operation using the policy of truncating most significant bits.
When the number of bits of the right operand is greater than or equal to that of the left operand or is less than 0, the least significant bits of the right operand are used as the number of bits to shift by, which depends on the number of IntNative bits in the current system.
Parameters:
- y: IntNative: number of bits to shift by
Returns:
- IntNative: left shift operation result
func wrappingShr(IntNative)
public func wrappingShr(y: IntNative): IntNative
Description: Performs right shift operation using the policy of truncating most significant bits.
When the number of bits of the right operand is greater than or equal to that of the left operand or is less than 0, the least significant bits of the right operand are used as the number of bits to shift by, which depends on the number of IntNative bits in the current system.
Parameters:
- y: IntNative: number of bits to shift by
Returns:
- IntNative: right shift operation result
func wrappingSub(IntNative)
public func wrappingSub(y: IntNative): IntNative
Description: Performs subtraction operation using the policy of truncating most significant bits.
When an overflow occurs in an operation, most significant bits are truncated. Otherwise, the operation result is returned.
Parameters:
- y: IntNative: subtrahend
Returns:
- IntNative: subtraction operation result
extend UInt16 <: WrappingOp<UInt16>
extend UInt16 <: WrappingOp<UInt16>
Description: Implements the WrappingOp interface for UInt16.
Parent Type:
func wrappingAdd(UInt16)
public func wrappingAdd(y: UInt16): UInt16
Description: Performs addition operation using the policy of truncating most significant bits.
When an overflow occurs in an operation, most significant bits are truncated. Otherwise, the operation result is returned.
Parameters:
- y: UInt16: addend
Returns:
- UInt16: addition operation result
func wrappingDec()
public func wrappingDec(): UInt16
Description: Performs auto-decrement operation using the policy of truncating most significant bits.
When an overflow occurs in an operation, most significant bits are truncated. Otherwise, the operation result is returned.
Returns:
- UInt16: auto-decrement operation result
func wrappingDiv(UInt16)
public func wrappingDiv(y: UInt16): UInt16
Description: Performs division operation using the policy of truncating most significant bits.
When an overflow occurs in an operation, most significant bits are truncated. Otherwise, the operation result is returned.
Parameters:
- y: UInt16: divisor
Returns:
- UInt16: division operation result
func wrappingInc()
public func wrappingInc(): UInt16
Description: Performs auto-increment operation using the policy of truncating most significant bits.
When an overflow occurs in an operation, most significant bits are truncated. Otherwise, the operation result is returned.
Returns:
- UInt16: auto-increment operation result
func wrappingMod(UInt16)
public func wrappingMod(y: UInt16): UInt16
Description: Performs modulo operation using the policy of truncating most significant bits.
When an overflow occurs in an operation, most significant bits are truncated. Otherwise, the operation result is returned.
Parameters:
- y: UInt16: divisor
Returns:
- UInt16: modulo operation result
func wrappingMul(UInt16)
public func wrappingMul(y: UInt16): UInt16
Description: Performs multiplication operation using the policy of truncating most significant bits.
When an overflow occurs in an operation, most significant bits are truncated. Otherwise, the operation result is returned.
Parameters:
- y: UInt16: multiplier
Returns:
- UInt16: multiplication operation result
func wrappingNeg()
public func wrappingNeg(): UInt16
Description: Performs negation operation using the policy of truncating most significant bits.
When an overflow occurs in an operation, most significant bits are truncated. Otherwise, the operation result is returned.
Returns:
- UInt16: negation operation result
func wrappingShl(UInt16)
public func wrappingShl(y: UInt16): UInt16
Description: Performs left shift operation using the policy of truncating most significant bits.
When the number of bits of the right operand is greater than or equal to that of the left operand, the 4 least significant bits of the right operand are used as the number of bits to shift by.
Parameters:
- y: UInt16: number of bits to shift by
Returns:
- UInt16: left shift operation result
func wrappingShr(UInt16)
public func wrappingShr(y: UInt16): UInt16
Description: Performs right shift operation using the policy of truncating most significant bits.
When the number of bits of the right operand is greater than or equal to that of the left operand, the 4 least significant bits of the right operand are used as the number of bits to shift by.
Parameters:
- y: UInt16: number of bits to shift by
Returns:
- UInt16: right shift operation result
func wrappingSub(UInt16)
public func wrappingSub(y: UInt16): UInt16
Description: Performs subtraction operation using the policy of truncating most significant bits.
When an overflow occurs in an operation, most significant bits are truncated. Otherwise, the operation result is returned.
Parameters:
- y: UInt16: subtrahend
Returns:
- UInt16: subtraction operation result
extend UInt32 <: WrappingOp<UInt32>
extend UInt32 <: WrappingOp<UInt32>
Description: Implements the WrappingOp interface for UInt32.
Parent Type:
func wrappingAdd(UInt32)
public func wrappingAdd(y: UInt32): UInt32
Description: Performs addition operation using the policy of truncating most significant bits.
When an overflow occurs in an operation, most significant bits are truncated. Otherwise, the operation result is returned.
Parameters:
- y: UInt32: addend
Returns:
- UInt32: addition operation result
func wrappingDec()
public func wrappingDec(): UInt32
Description: Performs auto-decrement operation using the policy of truncating most significant bits.
When an overflow occurs in an operation, most significant bits are truncated. Otherwise, the operation result is returned.
Returns:
- UInt32: auto-decrement operation result
func wrappingDiv(UInt32)
public func wrappingDiv(y: UInt32): UInt32
Description: Performs division operation using the policy of truncating most significant bits.
When an overflow occurs in an operation, most significant bits are truncated. Otherwise, the operation result is returned.
Parameters:
- y: UInt32: divisor
Returns:
- UInt32: division operation result
func wrappingInc()
public func wrappingInc(): UInt32
Description: Performs auto-increment operation using the policy of truncating most significant bits.
When an overflow occurs in an operation, most significant bits are truncated. Otherwise, the operation result is returned.
Returns:
- UInt32: auto-increment operation result
func wrappingMod(UInt32)
public func wrappingMod(y: UInt32): UInt32
Description: Performs modulo operation using the policy of truncating most significant bits.
When an overflow occurs in an operation, most significant bits are truncated. Otherwise, the operation result is returned.
Parameters:
- y: UInt32: divisor
Returns:
- UInt32: modulo operation result
func wrappingMul(UInt32)
public func wrappingMul(y: UInt32): UInt32
Description: Performs multiplication operation using the policy of truncating most significant bits.
When an overflow occurs in an operation, most significant bits are truncated. Otherwise, the operation result is returned.
Parameters:
- y: UInt32: multiplier
Returns:
- UInt32: multiplication operation result
func wrappingNeg()
public func wrappingNeg(): UInt32
Description: Performs negation operation using the policy of truncating most significant bits.
When an overflow occurs in an operation, most significant bits are truncated. Otherwise, the operation result is returned.
Returns:
- UInt32: negation operation result
func wrappingShl(UInt32)
public func wrappingShl(y: UInt32): UInt32
Description: Performs left shift operation using the policy of truncating most significant bits.
When the number of bits of the right operand is greater than or equal to that of the left operand, the 5 least significant bits of the right operand are used as the number of bits to shift by.
Parameters:
- y: UInt32: number of bits to shift by
Returns:
- UInt32: left shift operation result
func wrappingShr(UInt32)
public func wrappingShr(y: UInt32): UInt32
Description: Performs right shift operation using the policy of truncating most significant bits.
When the number of bits of the right operand is greater than or equal to that of the left operand, the 5 least significant bits of the right operand are used as the number of bits to shift by.
Parameters:
- y: UInt32: number of bits to shift by
Returns:
- UInt32: right shift operation result
func wrappingSub(UInt32)
public func wrappingSub(y: UInt32): UInt32
Description: Performs subtraction operation using the policy of truncating most significant bits.
When an overflow occurs in an operation, most significant bits are truncated. Otherwise, the operation result is returned.
Parameters:
- y: UInt32: subtrahend
Returns:
- UInt32: subtraction operation result
extend UInt64 <: WrappingOp<UInt64>
extend UInt64 <: WrappingOp<UInt64>
Description: Implements the WrappingOp interface for UInt64.
Parent Type:
func wrappingAdd(UInt64)
public func wrappingAdd(y: UInt64): UInt64
Description: Performs addition operation using the policy of truncating most significant bits.
When an overflow occurs in an operation, most significant bits are truncated. Otherwise, the operation result is returned.
Parameters:
- y: UInt64: addend
Returns:
- UInt64: addition operation result
func wrappingDec()
public func wrappingDec(): UInt64
Description: Performs auto-decrement operation using the policy of truncating most significant bits.
When an overflow occurs in an operation, most significant bits are truncated. Otherwise, the operation result is returned.
Returns:
- UInt64: auto-decrement operation result
func wrappingDiv(UInt64)
public func wrappingDiv(y: UInt64): UInt64
Description: Performs division operation using the policy of truncating most significant bits.
When an overflow occurs in an operation, most significant bits are truncated. Otherwise, the operation result is returned.
Parameters:
- y: UInt64: divisor
Returns:
- UInt64: division operation result
func wrappingInc()
public func wrappingInc(): UInt64
Description: Performs auto-increment operation using the policy of truncating most significant bits.
When an overflow occurs in an operation, most significant bits are truncated. Otherwise, the operation result is returned.
Returns:
- UInt64: auto-increment operation result
func wrappingMod(UInt64)
public func wrappingMod(y: UInt64): UInt64
Description: Performs modulo operation using the policy of truncating most significant bits.
When an overflow occurs in an operation, most significant bits are truncated. Otherwise, the operation result is returned.
Parameters:
- y: UInt64: divisor
Returns:
- UInt64: modulo operation result
func wrappingMul(UInt64)
public func wrappingMul(y: UInt64): UInt64
Description: Performs multiplication operation using the policy of truncating most significant bits.
When an overflow occurs in an operation, most significant bits are truncated. Otherwise, the operation result is returned.
Parameters:
- y: UInt64: multiplier
Returns:
- UInt64: multiplication operation result
func wrappingNeg()
public func wrappingNeg(): UInt64
Description: Performs negation operation using the policy of truncating most significant bits.
When an overflow occurs in an operation, most significant bits are truncated. Otherwise, the operation result is returned.
Returns:
- UInt64: negation operation result
func wrappingShl(UInt64)
public func wrappingShl(y: UInt64): UInt64
Description: Performs left shift operation using the policy of truncating most significant bits.
When the number of bits of the right operand is greater than or equal to that of the left operand, the 6 least significant bits of the right operand are used as the number of bits to shift by.
Parameters:
- y: UInt64: number of bits to shift by
Returns:
- UInt64: left shift operation result
func wrappingShr(UInt64)
public func wrappingShr(y: UInt64): UInt64
Description: Performs right shift operation using the policy of truncating most significant bits.
When the number of bits of the right operand is greater than or equal to that of the left operand, the 6 least significant bits of the right operand are used as the number of bits to shift by.
Parameters:
- y: UInt64: number of bits to shift by
Returns:
- UInt64: right shift operation result
func wrappingSub(UInt64)
public func wrappingSub(y: UInt64): UInt64
Description: Performs subtraction operation using the policy of truncating most significant bits.
When an overflow occurs in an operation, most significant bits are truncated. Otherwise, the operation result is returned.
Parameters:
- y: UInt64: subtrahend
Returns:
- UInt64: subtraction operation result
extend UInt8 <: WrappingOp<UInt8>
extend UInt8 <: WrappingOp<UInt8>
Description: Implements the WrappingOp interface for UInt8.
Parent Type:
func wrappingAdd(UInt8)
public func wrappingAdd(y: UInt8): UInt8
Description: Performs addition operation using the policy of truncating most significant bits.
When an overflow occurs in an operation, most significant bits are truncated. Otherwise, the operation result is returned.
Parameters:
- y: UInt8: addend
Returns:
- UInt8: addition operation result
func wrappingDec()
public func wrappingDec(): UInt8
Description: Performs auto-decrement operation using the policy of truncating most significant bits.
When an overflow occurs in an operation, most significant bits are truncated. Otherwise, the operation result is returned.
Returns:
- UInt8: auto-decrement operation result
func wrappingDiv(UInt8)
public func wrappingDiv(y: UInt8): UInt8
Description: Performs division operation using the policy of truncating most significant bits.
When an overflow occurs in an operation, most significant bits are truncated. Otherwise, the operation result is returned.
Parameters:
- y: UInt8: divisor
Returns:
- UInt8: division operation result
func wrappingInc()
public func wrappingInc(): UInt8
Description: Performs auto-increment operation using the policy of truncating most significant bits.
When an overflow occurs in an operation, most significant bits are truncated. Otherwise, the operation result is returned.
Returns:
- UInt8: auto-increment operation result
func wrappingMod(UInt8)
public func wrappingMod(y: UInt8): UInt8
Description: Performs modulo operation using the policy of truncating most significant bits.
When an overflow occurs in an operation, most significant bits are truncated. Otherwise, the operation result is returned.
Parameters:
- y: UInt8: divisor
Returns:
- UInt8: modulo operation result
func wrappingMul(UInt8)
public func wrappingMul(y: UInt8): UInt8
Description: Performs multiplication operation using the policy of truncating most significant bits.
When an overflow occurs in an operation, most significant bits are truncated. Otherwise, the operation result is returned.
Parameters:
- y: UInt8: multiplier
Returns:
- UInt8: multiplication operation result
func wrappingNeg()
public func wrappingNeg(): UInt8
Description: Performs negation operation using the policy of truncating most significant bits.
When an overflow occurs in an operation, most significant bits are truncated. Otherwise, the operation result is returned.
Returns:
- UInt8: negation operation result
func wrappingShl(UInt8)
public func wrappingShl(y: UInt8): UInt8
Description: Performs left shift operation using the policy of truncating most significant bits.
When the number of bits of the right operand is greater than or equal to that of the left operand, the 3 least significant bits of the right operand are used as the number of bits to shift by.
Parameters:
- y: UInt8: number of bits to shift by
Returns:
- UInt8: left shift operation result
func wrappingShr(UInt8)
public func wrappingShr(y: UInt8): UInt8
Description: Performs right shift operation using the policy of truncating most significant bits.
When the number of bits of the right operand is greater than or equal to that of the left operand, the 3 least significant bits of the right operand are used as the number of bits to shift by.
Parameters:
- y: UInt8: number of bits to shift by
Returns:
- UInt8: right shift operation result
func wrappingSub(UInt8)
public func wrappingSub(y: UInt8): UInt8
Description: Performs subtraction operation using the policy of truncating most significant bits.
When an overflow occurs in an operation, most significant bits are truncated. Otherwise, the operation result is returned.
Parameters:
- y: UInt8: subtrahend
Returns:
- UInt8: subtraction operation result
extend UIntNative <: WrappingOp<UIntNative>
extend UIntNative <: WrappingOp<UIntNative>
Description: Implements the WrappingOp interface for UIntNative.
Parent Type:
func wrappingAdd(UIntNative)
public func wrappingAdd(y: UIntNative): UIntNative
Description: Performs addition operation using the policy of truncating most significant bits.
When an overflow occurs in an operation, most significant bits are truncated. Otherwise, the operation result is returned.
Parameters:
- y: UIntNative: addend
Returns:
- UIntNative: addition operation result
func wrappingDec()
public func wrappingDec(): UIntNative
Description: Performs auto-decrement operation using the policy of truncating most significant bits.
When an overflow occurs in an operation, most significant bits are truncated. Otherwise, the operation result is returned.
Returns:
- UIntNative: auto-decrement operation result
func wrappingDiv(UIntNative)
public func wrappingDiv(y: UIntNative): UIntNative
Description: Performs division operation using the policy of truncating most significant bits.
When an overflow occurs in an operation, most significant bits are truncated. Otherwise, the operation result is returned.
Parameters:
- y: UIntNative: divisor
Returns:
- UIntNative: division operation result
func wrappingInc()
public func wrappingInc(): UIntNative
Description: Performs auto-increment operation using the policy of truncating most significant bits.
When an overflow occurs in an operation, most significant bits are truncated. Otherwise, the operation result is returned.
Returns:
- UIntNative: auto-increment operation result
func wrappingMod(UIntNative)
public func wrappingMod(y: UIntNative): UIntNative
Description: Performs modulo operation using the policy of truncating most significant bits.
When an overflow occurs in an operation, most significant bits are truncated. Otherwise, the operation result is returned.
Parameters:
- y: UIntNative: divisor
Returns:
- UIntNative: modulo operation result
func wrappingMul(UIntNative)
public func wrappingMul(y: UIntNative): UIntNative
Description: Performs multiplication operation using the policy of truncating most significant bits.
When an overflow occurs in an operation, most significant bits are truncated. Otherwise, the operation result is returned.
Parameters:
- y: UIntNative: multiplier
Returns:
- UIntNative: multiplication operation result
func wrappingNeg()
public func wrappingNeg(): UIntNative
Description: Performs negation operation using the policy of truncating most significant bits.
When an overflow occurs in an operation, most significant bits are truncated. Otherwise, the operation result is returned.
Returns:
- UIntNative: negation operation result
func wrappingShl(UIntNative)
public func wrappingShl(y: UIntNative): UIntNative
Description: Performs left shift operation using the policy of truncating most significant bits.
When the number of bits of the right operand is greater than or equal to that of the left operand, the least significant bits of the right operand are used as the number of bits to shift by, which depends on the number of UIntNative bits in the current system.
Parameters:
- y: UIntNative: number of bits to shift by
Returns:
- UIntNative: left shift operation result
func wrappingShr(UIntNative)
public func wrappingShr(y: UIntNative): UIntNative
Description: Performs right shift operation using the policy of truncating most significant bits.
When the number of bits of the right operand is greater than or equal to that of the left operand, the least significant bits of the right operand are used as the number of bits to shift by, which depends on the number of UIntNative bits in the current system.
Parameters:
- y: UIntNative: number of bits to shift by
Returns:
- UIntNative: right shift operation result
func wrappingSub(UIntNative)
public func wrappingSub(y: UIntNative): UIntNative
Description: Performs subtraction operation using the policy of truncating most significant bits.
When an overflow occurs in an operation, most significant bits are truncated. Otherwise, the operation result is returned.
Parameters:
- y: UIntNative: subtrahend
Returns:
- UIntNative: subtraction operation result