Pure Nim implementations of arithmetic operations for integers.
Procs
func borrowingSub[T: SomeSignedInt](a, b: T; borrowIn: bool): (T, bool) {. inline, noinit.}
- Source Edit
func borrowingSub[T: SomeUnsignedInt](a, b: T; borrowIn: bool): (T, bool) {. inline, noinit.}
- Source Edit
func carryingAdd[T: SomeSignedInt](a, b: T; carryIn: bool): (T, bool) {.inline, noinit.}
- Source Edit
func carryingAdd[T: SomeUnsignedInt](a, b: T; carryIn: bool): (T, bool) {. inline, noinit.}
- Source Edit
func mulDoubleAdd2[T: uint64 | uint32](a, b, c, dHi, dLo: T): (T, T, T) {. inline, noinit.}
- Source Edit
func narrowingDiv(uHi, uLo, v: uint64): (uint64, uint64) {.inline, noinit, ...raises: [], tags: [], forbids: [].}
- Knuth's Algorithm D (Division of nonnegative integers) implementation. Source Edit
func overflowingAdd[T: SomeSignedInt](a, b: T): (T, bool) {.inline, noinit.}
- Source Edit
func overflowingAdd[T: SomeUnsignedInt](a, b: T): (T, bool) {.inline, noinit.}
- Source Edit
func overflowingSub[T: SomeSignedInt](a, b: T): (T, bool) {.inline, noinit.}
- Source Edit
func overflowingSub[T: SomeUnsignedInt](a, b: T): (T, bool) {.inline, noinit.}
- Source Edit
func saturatingAdd[T: SomeSignedInt](a, b: T): T {.inline, noinit.}
- Source Edit
func saturatingAdd[T: SomeUnsignedInt](a, b: T): T {.inline, noinit.}
- Source Edit
func saturatingSub[T: SomeSignedInt](a, b: T): T {.inline, noinit.}
- Source Edit
func saturatingSub[T: SomeUnsignedInt](a, b: T): T {.inline, noinit.}
- Source Edit
func wideningMul(a, b: int32): (int32, uint32) {.inline, noinit, ...raises: [], tags: [], forbids: [].}
- Source Edit
func wideningMul(a, b: int64): (int64, uint64) {.inline, noinit, ...raises: [], tags: [], forbids: [].}
- Source Edit
func wideningMul(a, b: uint32): (uint32, uint32) {.inline, noinit, ...raises: [], tags: [], forbids: [].}
- Source Edit
func wideningMul(a, b: uint64): (uint64, uint64) {.inline, noinit, ...raises: [], tags: [], forbids: [].}
- Source Edit
func wideningMulAdd(a, b, c, d: uint64): (uint64, uint64) {.inline, noinit, ...raises: [], tags: [], forbids: [].}
- Source Edit
func wideningMulAdd(a, b, c: uint64): (uint64, uint64) {.inline, noinit, ...raises: [], tags: [], forbids: [].}
- Source Edit