w64.bend checks
raw source on the hub · import bend-safetensors-reader@0.1.0.0/w64.bend as W64
Unsigned 64-bit numbers as two U32 halves, for file offsets and byte counts past 4 GiB. Bend's Nat is unary at run time, and Base has no 64-bit integer, so offsets are W64{hi, lo} = hi * 2^32 + lo. Overflow is checked: an operation that would pass 2^64 - 1 answers None.
1 import
import Base
Types
type W64 source · line 6 · raw
Data
W64@hi:U32 -> @lo:U32 -> W64
Definitions
def W64.zero source · line 9 · raw
W64
def W64.of source · line 12 · raw
@+x:U32 -> W64
def W64.hi source · line 15 · raw
@a:W64 -> U32
def W64.lo source · line 20 · raw
@a:W64 -> U32
def W64.is_eq source · line 25 · raw
@a:W64 -> @b:W64 -> Bool
def W64.is_lt source · line 30 · raw
@a:W64 -> @b:W64 -> Bool
def W64.is_le source · line 35 · raw
@a:W64 -> @b:W64 -> Bool
def W64.carry source · line 40 · raw
@+x:U32 -> @+s:U32 -> U32
def W64.ok source · line 43 · raw
@fits:Bool -> @r:W64 -> Maybe<&2, W64>
def W64.add_hi source · line 50 · raw
@+ah:U32 -> @+bh:U32 -> @+c:U32 -> @+lo:U32 -> Maybe<&2, W64>
def W64.add source · line 56 · raw
@a:W64 -> @b:W64 -> Maybe<&2, W64>
a + b, or None past 2^64 - 1
def W64.sub source · line 63 · raw
@a:W64 -> @b:W64 -> W64
a - b, for b <= a (wraps otherwise)
def W64.mul32_fin source · line 68 · raw
@+p00:U32 -> @+p11:U32 -> @+mid:U32 -> @+c1:U32 -> W64
def W64.mul32 source · line 73 · raw
@+a:U32 -> @+b:U32 -> W64
the full 64-bit product of two U32, from 16-bit halves
def W64.mul_fin source · line 82 · raw
@top:W64 -> @low:W64 -> Maybe<&2, W64>
def W64.mul source · line 89 · raw
@a:W64 -> @+m:U32 -> Maybe<&2, W64>
a * m, or None past 2^64 - 1
def W64.then_add source · line 94 · raw
@r:Maybe<&2, W64> -> @+d:U32 -> Maybe<&2, W64>
def W64.digit source · line 102 · raw
@a:W64 -> @+d:U32 -> Maybe<&2, W64>
a * 10 + d (a decimal digit), or None past 2^64 - 1
def W64.cells_fin source · line 106 · raw
@exact:Bool -> @+h:U32 -> @+l:U32 -> W64
ceil(a / 4), the 32-bit cells that hold a bytes
def W64.cells source · line 114 · raw
@a:W64 -> W64
def W64.hex source · line 119 · raw
@+x:U32 -> String
def W64.show_go source · line 123 · raw
@+h:U32 -> @+l:U32 -> String
as 0x<high>_<low>, in hex
def W64.show source · line 126 · raw
@a:W64 -> String