compiler/utils/int128

    Dark Mode
Search:
  Source   Edit

This module is for compiler internal use only. For reliable error messages and range checks, the compiler needs a data type that can hold all from low(BiggestInt) to high(BiggestUInt), This type is for that purpose.

Types

Int128 = object
  udata: array[4, uint32]
  Source   Edit

Consts

Max = (udata: [4294967295'u32, 4294967295'u32, 4294967295'u32, 2147483647'u32])
  Source   Edit
Min = (udata: [0'u32, 0'u32, 0'u32, 2147483648'u32])
  Source   Edit
NegOne = (udata: [4294967295'u32, 4294967295'u32, 4294967295'u32, 4294967295'u32])
  Source   Edit
One = (udata: [1'u32, 0'u32, 0'u32, 0'u32])
  Source   Edit
Ten = (udata: [10'u32, 0'u32, 0'u32, 0'u32])
  Source   Edit
Zero = (udata: [0'u32, 0'u32, 0'u32, 0'u32])
  Source   Edit

Procs

proc `$`(a: Int128): string {....raises: [], tags: [].}
  Source   Edit
proc `*=`(a: var Int128; b: int32): Int128 {....raises: [], tags: [].}
  Source   Edit
proc `*=`(a: var Int128; b: Int128) {....raises: [], tags: [].}
  Source   Edit
proc `*`(a: Int128; b: int32): Int128 {....raises: [], tags: [].}
  Source   Edit
proc `*`(lhs, rhs: Int128): Int128 {....raises: [], tags: [].}
  Source   Edit
proc `+=`(a: var Int128; b: Int128) {....raises: [], tags: [].}
  Source   Edit
proc `+`(a, b: Int128): Int128 {....raises: [], tags: [].}
  Source   Edit
proc `+`(a: BiggestInt; b: Int128): Int128 {....raises: [], tags: [].}
  Source   Edit
proc `+`(a: Int128; b: BiggestInt): Int128 {....raises: [], tags: [].}
  Source   Edit
proc `-=`(a: var Int128; b: Int128) {....raises: [], tags: [].}
  Source   Edit
proc `-`(a, b: Int128): Int128 {....raises: [], tags: [].}
  Source   Edit
proc `-`(a: BiggestInt; b: Int128): Int128 {....raises: [], tags: [].}
  Source   Edit
proc `-`(a: Int128): Int128 {....raises: [], tags: [].}
  Source   Edit
proc `-`(a: Int128; b: BiggestInt): Int128 {....raises: [], tags: [].}
  Source   Edit
proc `<=`(a, b: Int128): bool {....raises: [], tags: [].}
  Source   Edit
proc `<=`(a: BiggestInt; b: Int128): bool {....raises: [], tags: [].}
  Source   Edit
proc `<=`(a: Int128; b: BiggestInt): bool {....raises: [], tags: [].}
  Source   Edit
proc `<`(a, b: Int128): bool {....raises: [], tags: [].}
  Source   Edit
proc `<`(a: BiggestInt; b: Int128): bool {....raises: [], tags: [].}
  Source   Edit
proc `<`(a: Int128; b: BiggestInt): bool {....raises: [], tags: [].}
  Source   Edit
proc `==`(a, b: Int128): bool {....raises: [], tags: [].}
  Source   Edit
proc `==`(a: BiggestInt; b: Int128): bool {....raises: [], tags: [].}
  Source   Edit
proc `==`(a: Int128; b: BiggestInt): bool {....raises: [], tags: [].}
  Source   Edit
proc `div`(a, b: Int128): Int128 {....raises: [], tags: [].}
  Source   Edit
proc `mod`(a, b: Int128): Int128 {....raises: [], tags: [].}
  Source   Edit
proc `shl`(a: Int128; b: int): Int128 {....raises: [], tags: [].}
  Source   Edit
proc `shr`(a: Int128; b: int): Int128 {....raises: [], tags: [].}
  Source   Edit
proc abs(a: Int128): Int128 {....raises: [], tags: [].}
  Source   Edit
proc addInt128(result: var string; value: Int128) {....raises: [], tags: [].}
  Source   Edit
proc addToHex(result: var string; arg: Int128) {....raises: [], tags: [].}
  Source   Edit
proc bitand(a, b: Int128): Int128 {....raises: [], tags: [].}
  Source   Edit
proc bitnot(a: Int128): Int128 {....raises: [], tags: [].}
  Source   Edit
proc bitor(a, b: Int128): Int128 {....raises: [], tags: [].}
  Source   Edit
proc bitxor(a, b: Int128): Int128 {....raises: [], tags: [].}
  Source   Edit
proc castToInt64(arg: Int128): int64 {....raises: [], tags: [].}
Conversion to int64 without range check.   Source   Edit
proc castToUInt64(arg: Int128): uint64 {....raises: [], tags: [].}
Conversion to uint64 without range check.   Source   Edit
proc cmp(a, b: Int128): int {....raises: [], tags: [].}
  Source   Edit
proc divMod(dividend, divisor: Int128): tuple[quotient, remainder: Int128] {.
    ...raises: [], tags: [].}
  Source   Edit
proc fastLog2(a: Int128): int {....raises: [], tags: [].}
  Source   Edit
proc inc(a: var Int128; y: uint32 = 1) {....raises: [], tags: [].}
  Source   Edit
proc inInt128Range(arg: float64): bool {....raises: [], tags: [].}
Simple range check. Of coures NaN is defined not to be in range.   Source   Edit
proc maskBytes(arg: Int128; numbytes: int): Int128 {.noinit, ...raises: [],
    tags: [].}
  Source   Edit
proc maskUInt8(arg: Int128): Int128 {.noinit, inline, ...raises: [], tags: [].}
  Source   Edit
proc maskUInt16(arg: Int128): Int128 {.noinit, inline, ...raises: [], tags: [].}
  Source   Edit
proc maskUInt32(arg: Int128): Int128 {.noinit, inline, ...raises: [], tags: [].}
  Source   Edit
proc maskUInt64(arg: Int128): Int128 {.noinit, inline, ...raises: [], tags: [].}
  Source   Edit
proc parseDecimalInt128(arg: string; pos: int = 0): Int128 {....raises: [],
    tags: [].}
  Source   Edit
proc toFloat64(arg: Int128): float64 {....raises: [], tags: [].}
  Source   Edit
proc toHex(arg: Int128): string {....raises: [], tags: [].}
  Source   Edit
proc toInt(arg: Int128): int {....raises: [], tags: [].}
  Source   Edit
proc toInt8(arg: Int128): int8 {....raises: [], tags: [].}
  Source   Edit
proc toInt16(arg: Int128): int16 {....raises: [], tags: [].}
  Source   Edit
proc toInt32(arg: Int128): int32 {....raises: [], tags: [].}
  Source   Edit
proc toInt64(arg: Int128): int64 {....raises: [], tags: [].}
  Source   Edit
proc toInt64Checked(arg: Int128; onError: int64): int64 {....raises: [], tags: [].}
  Source   Edit
proc toInt128(arg: float64): Int128 {....raises: [], tags: [].}
  Source   Edit
proc toInt128[T: SomeInteger | bool](arg: T): Int128
  Source   Edit
proc toUInt(arg: Int128): uint {....raises: [], tags: [].}
  Source   Edit
proc toUInt8(arg: Int128): uint8 {....raises: [], tags: [].}
  Source   Edit
proc toUInt16(arg: Int128): uint16 {....raises: [], tags: [].}
  Source   Edit
proc toUInt32(arg: Int128): uint32 {....raises: [], tags: [].}
  Source   Edit
proc toUInt64(arg: Int128): uint64 {....raises: [], tags: [].}
  Source   Edit

Templates

template high(t: typedesc[Int128]): Int128
  Source   Edit
template low(t: typedesc[Int128]): Int128
  Source   Edit