~/bend-docscommunity

src/math/u64.bend checks

raw source on the hub · import 0xd9a2fae439ac7ff9e21e0853948f94fe/src/math/u64.bend as U64

1 import
import Base

Types

type U64 source · line 13 · raw

Data

Definitions

def zero source · line 16 · raw

U64

def of_u32 source · line 19 · raw

@+x:U32 -> U64

def is_zero source · line 22 · raw

@a:U64 -> Bool

def carry source · line 26 · raw

@b:Bool -> U32

def add_fin source · line 33 · raw

@+lo:U32 -> @+alo:U32 -> @+ahi:U32 -> @+bhi:U32 -> U64

def add source · line 37 · raw

@a:U64 -> @b:U64 -> U64

Wrapping 64-bit addition.

def neg_fin source · line 42 · raw

@+lo2:U32 -> @+hi:U32 -> U64

def neg source · line 46 · raw

@a:U64 -> U64

Two's-complement negation.

def order source · line 50 · raw

@high:Cmp -> @low:Cmp -> Cmp

def le_sign source · line 59 · raw

@+alo:U32 -> @+ahi:U32 -> @+blo:U32 -> @+bhi:U32 -> @negative_a:Bool -> @negative_b:Bool -> Bool

def le_signed source · line 69 · raw

@a:U64 -> @b:U64 -> Bool

a <= b as signed 64-bit integers.

def div_fin source · line 76 · raw

@+lo:U32 -> @+hi:U32 -> @+d:U32 -> @+t1:U32 -> @+t2:U32 -> @+t3:U32 -> U64

Long division in 32/12/12/8-bit digits: every partial remainder is below d <= 2^20, so each candidate r * 2^12 + digit stays below 2^32.

def div_t3 source · line 79 · raw

@+lo:U32 -> @+hi:U32 -> @+d:U32 -> @+t1:U32 -> @+t2:U32 -> U64

def div_t2 source · line 82 · raw

@+lo:U32 -> @+hi:U32 -> @+d:U32 -> @+t1:U32 -> U64

def div_small source · line 86 · raw

@a:U64 -> @+d:U32 -> U64

Unsigned a / d, for 0 < d <= 2^20.

def div_sign source · line 90 · raw

@a:U64 -> @+d:U32 -> @negative:Bool -> U64

def div_small_signed source · line 98 · raw

@a:U64 -> @+d:U32 -> U64

Signed a / d truncated toward zero (C semantics), for 0 < d <= 2^20.