Templates
template borrowingSub(a, b: int32; borrowIn: bool): (int32, bool)
-
Borrowing subtraction for signed 32-bit integers.
Takes two integers and returns their difference along with the borrow flag (BF): true means the previous subtraction had overflown, false means it hadn't.
Useful for chaining operations.
See also:
Source Edit template borrowingSub(a, b: int64; borrowIn: bool): tuple[res: int64, borrowOut: bool]
-
Borrowing subtraction for signed 64-bit integers.
Takes two integers and returns their difference along with the borrow flag (BF): true means the previous subtraction had overflown, false means it hadn't.
Useful for chaining operations.
See also:
Source Edit template borrowingSub(a, b: uint32; borrowIn: bool): tuple[res: uint32, borrowOut: bool]
-
Borrowing subtraction for unsigned 32-bit integers.
Takes two integers and returns their difference along with the borrow flag (BF): true means the previous subtraction had overflown, false means it hadn't.
Useful for chaining operations.
See also:
Source Edit template borrowingSub(a, b: uint64; borrowIn: bool): tuple[res: uint64, borrowOut: bool]
-
Borrowing subtraction for unsigned 64-bit integers.
Takes two integers and returns their difference along with the borrow flag (BF): true means the previous subtraction had overflown, false means it hadn't.
Useful for chaining operations.
See also:
Source Edit template overflowingSub[T: SomeInteger](a, b: T): tuple[res: T, didOverflow: bool]
-
Overflowing subtraction.
Takes two integers and returns their difference along with the overflow flag (OF): true means overflow happened, false means overflow didn't happen.
Subtraction wraps for both signed and unsigned integers, so this operation never raises.
See also:
Source Edit template saturatingSub[T: SomeInteger](a, b: T): T
-
Saturating subtraction.
Takes two integers and returns their difference; if the result won't fit within the type, the minimal possible value is returned.
See also:
Source Edit