This module implements basic arithmetic operators for unsigned integers. To discourage users from using unsigned, it's not part of system, but an extra import.
Procs
proc `not`[T](x: T): T {.magic: "BitnotI", noSideEffect.}
- computes the bitwise complement of the integer x. Source
proc `shr`[T](x, y: T): T {.magic: "ShrI", noSideEffect.}
- computes the shift right operation of x and y. Source
proc `shl`[T](x, y: T): T {.magic: "ShlI", noSideEffect.}
- computes the shift left operation of x and y. Source
proc `and`[T](x, y: T): T {.magic: "BitandI", noSideEffect.}
- computes the bitwise and of numbers x and y. Source
proc `or`[T](x, y: T): T {.magic: "BitorI", noSideEffect.}
- computes the bitwise or of numbers x and y. Source
proc `xor`[T](x, y: T): T {.magic: "BitxorI", noSideEffect.}
- computes the bitwise xor of numbers x and y. Source
proc `==`[T](x, y: T): bool {.magic: "EqI", noSideEffect.}
- Compares two unsigned integers for equality. Source
proc `+`[T](x, y: T): T {.magic: "AddU", noSideEffect.}
- Binary + operator for unsigned integers. Source
proc `-`[T](x, y: T): T {.magic: "SubU", noSideEffect.}
- Binary - operator for unsigned integers. Source
proc `*`[T](x, y: T): T {.magic: "MulU", noSideEffect.}
- Binary * operator for unsigned integers. Source
proc `div`[T](x, y: T): T {.magic: "DivU", noSideEffect.}
- computes the integer division. This is roughly the same as floor(x/y). Source
proc `mod`[T](x, y: T): T {.magic: "ModU", noSideEffect.}
- computes the integer modulo operation. This is the same as x - (x div y) * y. Source
proc `<=`[T](x, y: T): bool {.magic: "LeU", noSideEffect.}
- Returns true iff x <= y. Source
proc `<`[T](x, y: T): bool {.magic: "LtU", noSideEffect.}
- Returns true iff unsigned(x) < unsigned(y). Source