bend-kit-int Releases (2): 0.2.0.0 0x4eed9d7ac6ece61523d747a9d804e4f0 indexed https://jend.leeeet.dev/files.txt?path=bend-kit-int@0.2.0.0 0.1.0.0 0x0c38aaf55cb892078ec5d3c0609798a9 unindexed https://jend.leeeet.dev/files.txt?path=bend-kit-int@0.1.0.0 Definitions (326, 1 to 100 shown): Int.Int.bits.go (https://jend.leeeet.dev/definition.txt?path=bend-kit-int@0.2.0.0/int.bend&name=Int.bits.go) # The Int.* core serves only U64 and I64. When Base ships a native U64 (bendlang/bend#1027), delete it. def Int.bits.go(n: Nat, qr: Nat & Nat) -> Word(n): Int.Int.bits (https://jend.leeeet.dev/definition.txt?path=bend-kit-int@0.2.0.0/int.bend&name=Int.bits) # The low n bits of k: k mod 2^n. def Int.bits(n: Nat, k: Nat) -> Word(n): Int.Int.msb.go (https://jend.leeeet.dev/definition.txt?path=bend-kit-int@0.2.0.0/int.bend&name=Int.msb.go) def Int.msb.go(n: Nat, b: Bool, w: Word(n)) -> Bool: Int.Int.msb (https://jend.leeeet.dev/definition.txt?path=bend-kit-int@0.2.0.0/int.bend&name=Int.msb) def Int.msb(n: Nat, w: Word(n)) -> Bool: Int.Int.put_msb.bit (https://jend.leeeet.dev/definition.txt?path=bend-kit-int@0.2.0.0/int.bend&name=Int.put_msb.bit) def Int.put_msb.bit(p: Nat, v: Bool, b: Bool) -> Bool: Int.Int.put_msb (https://jend.leeeet.dev/definition.txt?path=bend-kit-int@0.2.0.0/int.bend&name=Int.put_msb) def Int.put_msb(+n: Nat, +v: Bool, w: Word(n)) -> Word(n): Int.Int.ext (https://jend.leeeet.dev/definition.txt?path=bend-kit-int@0.2.0.0/int.bend&name=Int.ext) def Int.ext(m: Nat, n: Nat, +fill: Bool, w: Word(n)) -> Word(m): Int.Int.ones (https://jend.leeeet.dev/definition.txt?path=bend-kit-int@0.2.0.0/int.bend&name=Int.ones) def Int.ones(+n: Nat) -> Word(n): Int.Int.min (https://jend.leeeet.dev/definition.txt?path=bend-kit-int@0.2.0.0/int.bend&name=Int.min) def Int.min(+n: Nat, s: Bool) -> Word(n): Int.Int.max (https://jend.leeeet.dev/definition.txt?path=bend-kit-int@0.2.0.0/int.bend&name=Int.max) def Int.max(+n: Nat, s: Bool) -> Word(n): Int.Int.is_eq (https://jend.leeeet.dev/definition.txt?path=bend-kit-int@0.2.0.0/int.bend&name=Int.is_eq) def Int.is_eq(+n: Nat, a: Word(n), b: Word(n)) -> Bool: Int.Int.is_zero (https://jend.leeeet.dev/definition.txt?path=bend-kit-int@0.2.0.0/int.bend&name=Int.is_zero) def Int.is_zero(+n: Nat, w: Word(n)) -> Bool: Int.Int.cmp (https://jend.leeeet.dev/definition.txt?path=bend-kit-int@0.2.0.0/int.bend&name=Int.cmp) def Int.cmp(+n: Nat, s: Bool, a: Word(n), b: Word(n)) -> Cmp: Int.Int.neg (https://jend.leeeet.dev/definition.txt?path=bend-kit-int@0.2.0.0/int.bend&name=Int.neg) def Int.neg(+n: Nat, w: Word(n)) -> Word(n): Int.Int.neg_if (https://jend.leeeet.dev/definition.txt?path=bend-kit-int@0.2.0.0/int.bend&name=Int.neg_if) def Int.neg_if(+n: Nat, c: Bool, w: Word(n)) -> Word(n): Int.Int.abs (https://jend.leeeet.dev/definition.txt?path=bend-kit-int@0.2.0.0/int.bend&name=Int.abs) def Int.abs(+n: Nat, +w: Word(n)) -> Word(n): Int.Int.udivmod.fin (https://jend.leeeet.dev/definition.txt?path=bend-kit-int@0.2.0.0/int.bend&name=Int.udivmod.fin) def Int.udivmod.fin(-p: Nat, q: Word(p), +n: Nat, s: Word(n), b: Word(n), g: Bool) -> Word(1n+p) & Word(n): Int.Int.udivmod.shl (https://jend.leeeet.dev/definition.txt?path=bend-kit-int@0.2.0.0/int.bend&name=Int.udivmod.shl) def Int.udivmod.shl(-p: Nat, q: Word(p), +n: Nat, +b: Word(n), ts: Bool & Word(n)) -> Word(1n+p) & Word(n): Int.Int.udivmod.rec (https://jend.leeeet.dev/definition.txt?path=bend-kit-int@0.2.0.0/int.bend&name=Int.udivmod.rec) def Int.udivmod.rec(-p: Nat, a0: Bool, +n: Nat, +b: Word(n), qr: Word(p) & Word(n)) -> Word(1n+p) & Word(n): Int.Int.udivmod.go (https://jend.leeeet.dev/definition.txt?path=bend-kit-int@0.2.0.0/int.bend&name=Int.udivmod.go) def Int.udivmod.go(m: Nat, a: Word(m), +n: Nat, +b: Word(n)) -> Word(m) & Word(n): Int.Int.sdivmod.fix (https://jend.leeeet.dev/definition.txt?path=bend-kit-int@0.2.0.0/int.bend&name=Int.sdivmod.fix) def Int.sdivmod.fix(+n: Nat, +na: Bool, nb: Bool, qr: Word(n) & Word(n)) -> Word(n) & Word(n): Int.Int.divmod.if (https://jend.leeeet.dev/definition.txt?path=bend-kit-int@0.2.0.0/int.bend&name=Int.divmod.if) # x / 0 is 0 and x % 0 is x, as in Base's U32. MIN / -1 wraps to MIN. def Int.divmod.if(z: Bool, s: Bool, +n: Nat, +a: Word(n), +b: Word(n)) -> Word(n) & Word(n): Int.Int.divmod (https://jend.leeeet.dev/definition.txt?path=bend-kit-int@0.2.0.0/int.bend&name=Int.divmod) def Int.divmod(+n: Nat, s: Bool, a: Word(n), +b: Word(n)) -> Word(n) & Word(n): Int.Int.fst (https://jend.leeeet.dev/definition.txt?path=bend-kit-int@0.2.0.0/int.bend&name=Int.fst) def Int.fst(-n: Nat, p: Word(n) & Word(n)) -> Word(n): Int.Int.snd (https://jend.leeeet.dev/definition.txt?path=bend-kit-int@0.2.0.0/int.bend&name=Int.snd) def Int.snd(-n: Nat, p: Word(n) & Word(n)) -> Word(n): Int.Int.div (https://jend.leeeet.dev/definition.txt?path=bend-kit-int@0.2.0.0/int.bend&name=Int.div) def Int.div(+n: Nat, s: Bool, a: Word(n), b: Word(n)) -> Word(n): Int.Int.mod (https://jend.leeeet.dev/definition.txt?path=bend-kit-int@0.2.0.0/int.bend&name=Int.mod) def Int.mod(+n: Nat, s: Bool, a: Word(n), b: Word(n)) -> Word(n): Int.Int.min_neg1 (https://jend.leeeet.dev/definition.txt?path=bend-kit-int@0.2.0.0/int.bend&name=Int.min_neg1) # True for signed MIN and -1, the one quotient that overflows. def Int.min_neg1(+n: Nat, s: Bool, a: Word(n), b: Word(n)) -> Bool: Int.Int.div_ov (https://jend.leeeet.dev/definition.txt?path=bend-kit-int@0.2.0.0/int.bend&name=Int.div_ov) def Int.div_ov(+n: Nat, s: Bool, a: Word(n), +b: Word(n)) -> Bool: Int.Int.add_ov.go (https://jend.leeeet.dev/definition.txt?path=bend-kit-int@0.2.0.0/int.bend&name=Int.add_ov.go) def Int.add_ov.go(+n: Nat, s: Bool, a: Word(n), b: Word(n), +r: Word(n)) -> Bool & Word(n): Int.Int.add_ov (https://jend.leeeet.dev/definition.txt?path=bend-kit-int@0.2.0.0/int.bend&name=Int.add_ov) def Int.add_ov(+n: Nat, s: Bool, +a: Word(n), +b: Word(n)) -> Bool & Word(n): Int.Int.sub_ov.go (https://jend.leeeet.dev/definition.txt?path=bend-kit-int@0.2.0.0/int.bend&name=Int.sub_ov.go) def Int.sub_ov.go(+n: Nat, s: Bool, +a: Word(n), b: Word(n), +r: Word(n)) -> Bool & Word(n): Int.Int.sub_ov (https://jend.leeeet.dev/definition.txt?path=bend-kit-int@0.2.0.0/int.bend&name=Int.sub_ov) def Int.sub_ov(+n: Nat, s: Bool, +a: Word(n), +b: Word(n)) -> Bool & Word(n): Int.Int.mul_ov.go (https://jend.leeeet.dev/definition.txt?path=bend-kit-int@0.2.0.0/int.bend&name=Int.mul_ov.go) def Int.mul_ov.go(+n: Nat, +s: Bool, +a: Word(n), +b: Word(n), +r: Word(n)) -> Bool & Word(n): Int.Int.mul_ov (https://jend.leeeet.dev/definition.txt?path=bend-kit-int@0.2.0.0/int.bend&name=Int.mul_ov) def Int.mul_ov(+n: Nat, s: Bool, +a: Word(n), +b: Word(n)) -> Bool & Word(n): Int.Int.checked (https://jend.leeeet.dev/definition.txt?path=bend-kit-int@0.2.0.0/int.bend&name=Int.checked) def Int.checked(-n: Nat, o: Bool & Word(n)) -> Maybe<&2, Word(n)>: Int.Int.checked_div (https://jend.leeeet.dev/definition.txt?path=bend-kit-int@0.2.0.0/int.bend&name=Int.checked_div) def Int.checked_div(+n: Nat, +s: Bool, +a: Word(n), +b: Word(n)) -> Maybe<&2, Word(n)>: Int.Int.checked_mod (https://jend.leeeet.dev/definition.txt?path=bend-kit-int@0.2.0.0/int.bend&name=Int.checked_mod) def Int.checked_mod(+n: Nat, +s: Bool, +a: Word(n), +b: Word(n)) -> Maybe<&2, Word(n)>: Int.Int.sat (https://jend.leeeet.dev/definition.txt?path=bend-kit-int@0.2.0.0/int.bend&name=Int.sat) def Int.sat(low: Bool, +n: Nat, s: Bool) -> Word(n): Int.Int.saturate (https://jend.leeeet.dev/definition.txt?path=bend-kit-int@0.2.0.0/int.bend&name=Int.saturate) def Int.saturate(+n: Nat, s: Bool, low: Bool, o: Bool & Word(n)) -> Word(n): Int.Int.saturating_add (https://jend.leeeet.dev/definition.txt?path=bend-kit-int@0.2.0.0/int.bend&name=Int.saturating_add) def Int.saturating_add(+n: Nat, +s: Bool, +a: Word(n), b: Word(n)) -> Word(n): Int.Int.saturating_sub (https://jend.leeeet.dev/definition.txt?path=bend-kit-int@0.2.0.0/int.bend&name=Int.saturating_sub) def Int.saturating_sub(+n: Nat, +s: Bool, +a: Word(n), b: Word(n)) -> Word(n): Int.Int.saturating_mul (https://jend.leeeet.dev/definition.txt?path=bend-kit-int@0.2.0.0/int.bend&name=Int.saturating_mul) def Int.saturating_mul(+n: Nat, +s: Bool, +a: Word(n), +b: Word(n)) -> Word(n): Int.Int.shl (https://jend.leeeet.dev/definition.txt?path=bend-kit-int@0.2.0.0/int.bend&name=Int.shl) def Int.shl(+n: Nat, k: Nat, w: Word(n)) -> Word(n): Int.Int.shr1 (https://jend.leeeet.dev/definition.txt?path=bend-kit-int@0.2.0.0/int.bend&name=Int.shr1) # Signed shifts right are arithmetic: the sign bit fills in from the top. def Int.shr1(+n: Nat, s: Bool, +w: Word(n)) -> Word(n): Int.Int.shr (https://jend.leeeet.dev/definition.txt?path=bend-kit-int@0.2.0.0/int.bend&name=Int.shr) def Int.shr(+n: Nat, +s: Bool, k: Nat, w: Word(n)) -> Word(n): Int.Radix.digit.if (https://jend.leeeet.dev/definition.txt?path=bend-kit-int@0.2.0.0/int.bend&name=Radix.digit.if) # Digit d below 36 as '0'..'9', then 'a'..'z'. def Radix.digit.if(lo: Bool, d: U32) -> Char: Int.Radix.digit (https://jend.leeeet.dev/definition.txt?path=bend-kit-int@0.2.0.0/int.bend&name=Radix.digit) def Radix.digit(+d: U32) -> Char: Int.Radix.in (https://jend.leeeet.dev/definition.txt?path=bend-kit-int@0.2.0.0/int.bend&name=Radix.in) def Radix.in(+c: U32, lo: U32, hi: U32) -> Bool: Int.Radix.value.lower (https://jend.leeeet.dev/definition.txt?path=bend-kit-int@0.2.0.0/int.bend&name=Radix.value.lower) def Radix.value.lower(ok: Bool, c: U32) -> U32: Int.Radix.value.upper (https://jend.leeeet.dev/definition.txt?path=bend-kit-int@0.2.0.0/int.bend&name=Radix.value.upper) def Radix.value.upper(ok: Bool, +c: U32) -> U32: Int.Radix.value.if (https://jend.leeeet.dev/definition.txt?path=bend-kit-int@0.2.0.0/int.bend&name=Radix.value.if) def Radix.value.if(ok: Bool, +c: U32) -> U32: Int.Radix.value (https://jend.leeeet.dev/definition.txt?path=bend-kit-int@0.2.0.0/int.bend&name=Radix.value) # The value of a digit in either case, or 36 when c is not a digit. def Radix.value(+c: U32) -> U32: Int.Radix.clamp (https://jend.leeeet.dev/definition.txt?path=bend-kit-int@0.2.0.0/int.bend&name=Radix.clamp) def Radix.clamp(r: U32) -> U32: Int.Radix.ok (https://jend.leeeet.dev/definition.txt?path=bend-kit-int@0.2.0.0/int.bend&name=Radix.ok) def Radix.ok(+r: U32) -> Bool: Int.Radix.sign.if (https://jend.leeeet.dev/definition.txt?path=bend-kit-int@0.2.0.0/int.bend&name=Radix.sign.if) def Radix.sign.if(neg: Bool, pos: Bool, c: Char, t: String) -> Bool & String: Int.Radix.sign (https://jend.leeeet.dev/definition.txt?path=bend-kit-int@0.2.0.0/int.bend&name=Radix.sign) # Splits one leading '-' or '+' off s: (negative, rest). def Radix.sign(s: String) -> Bool & String: Int.Int.show.go (https://jend.leeeet.dev/definition.txt?path=bend-kit-int@0.2.0.0/int.bend&name=Int.show.go) # z is set once the value left to print is zero; fuel n bounds the digits. def Int.show.go(f: Nat, +n: Nat, +b: Word(n), acc: String, z: Bool, qr: Word(n) & Word(n)) -> String: Int.Int.show.u (https://jend.leeeet.dev/definition.txt?path=bend-kit-int@0.2.0.0/int.bend&name=Int.show.u) def Int.show.u(+n: Nat, +b: Word(n), w: Word(n)) -> String: Int.Int.show.if (https://jend.leeeet.dev/definition.txt?path=bend-kit-int@0.2.0.0/int.bend&name=Int.show.if) def Int.show.if(neg: Bool, +n: Nat, +b: Word(n), w: Word(n)) -> String: Int.Int.show (https://jend.leeeet.dev/definition.txt?path=bend-kit-int@0.2.0.0/int.bend&name=Int.show) def Int.show(+n: Nat, s: Bool, r: U32, +w: Word(n)) -> String: Int.Int.read.add (https://jend.leeeet.dev/definition.txt?path=bend-kit-int@0.2.0.0/int.bend&name=Int.read.add) def Int.read.add(+n: Nat, d: Word(n), o: Bool & Word(n)) -> Maybe<&2, Word(n)>: Int.Int.read.dig (https://jend.leeeet.dev/definition.txt?path=bend-kit-int@0.2.0.0/int.bend&name=Int.read.dig) def Int.read.dig(ok: Bool, +n: Nat, +b: Word(n), acc: Word(n), d: U32) -> Maybe<&2, Word(n)>: Int.Int.read.step (https://jend.leeeet.dev/definition.txt?path=bend-kit-int@0.2.0.0/int.bend&name=Int.read.step) def Int.read.step(+n: Nat, +b: Word(n), +r: U32, st: Maybe<&2, Word(n)>, x: U32) -> Maybe<&2, Word(n)>: Int.Int.read.go (https://jend.leeeet.dev/definition.txt?path=bend-kit-int@0.2.0.0/int.bend&name=Int.read.go) def Int.read.go(s: String, +n: Nat, +b: Word(n), +r: U32, st: Maybe<&2, Word(n)>) -> Maybe<&2, Word(n)>: Int.Int.read.u (https://jend.leeeet.dev/definition.txt?path=bend-kit-int@0.2.0.0/int.bend&name=Int.read.u) def Int.read.u(+n: Nat, +b: Word(n), +r: U32, s: String) -> Maybe<&2, Word(n)>: Int.Int.read.fit (https://jend.leeeet.dev/definition.txt?path=bend-kit-int@0.2.0.0/int.bend&name=Int.read.fit) def Int.read.fit(bad: Bool, -n: Nat, w: Word(n)) -> Maybe<&2, Word(n)>: Int.Int.read.pos (https://jend.leeeet.dev/definition.txt?path=bend-kit-int@0.2.0.0/int.bend&name=Int.read.pos) def Int.read.pos(+n: Nat, m: Maybe<&2, Word(n)>) -> Maybe<&2, Word(n)>: Int.Int.read.neg (https://jend.leeeet.dev/definition.txt?path=bend-kit-int@0.2.0.0/int.bend&name=Int.read.neg) def Int.read.neg(+n: Nat, m: Maybe<&2, Word(n)>) -> Maybe<&2, Word(n)>: Int.Int.read.sign (https://jend.leeeet.dev/definition.txt?path=bend-kit-int@0.2.0.0/int.bend&name=Int.read.sign) def Int.read.sign(s: Bool, neg: Bool, +n: Nat, +b: Word(n), +r: U32, t: String) -> Maybe<&2, Word(n)>: Int.Int.read.split (https://jend.leeeet.dev/definition.txt?path=bend-kit-int@0.2.0.0/int.bend&name=Int.read.split) def Int.read.split(s: Bool, +n: Nat, +r: U32, p: Bool & String) -> Maybe<&2, Word(n)>: Int.Int.read.if (https://jend.leeeet.dev/definition.txt?path=bend-kit-int@0.2.0.0/int.bend&name=Int.read.if) def Int.read.if(ok: Bool, +n: Nat, s: Bool, +r: U32, str: String) -> Maybe<&2, Word(n)>: Int.Int.read (https://jend.leeeet.dev/definition.txt?path=bend-kit-int@0.2.0.0/int.bend&name=Int.read) def Int.read(+n: Nat, s: Bool, +r: U32, str: String) -> Maybe<&2, Word(n)>: Int.Int.to_nat.s (https://jend.leeeet.dev/definition.txt?path=bend-kit-int@0.2.0.0/int.bend&name=Int.to_nat.s) def Int.to_nat.s(neg: Bool, n: Nat, w: Word(n)) -> Maybe<&2, Nat>: Int.Int.to_nat (https://jend.leeeet.dev/definition.txt?path=bend-kit-int@0.2.0.0/int.bend&name=Int.to_nat) # Signed values below zero have no Nat. def Int.to_nat(+n: Nat, +w: Word(n)) -> Maybe<&2, Nat>: Int.Int.sext (https://jend.leeeet.dev/definition.txt?path=bend-kit-int@0.2.0.0/int.bend&name=Int.sext) def Int.sext(m: Nat, +n: Nat, +w: Word(n)) -> Word(m): Int.Nar.opt (https://jend.leeeet.dev/definition.txt?path=bend-kit-int@0.2.0.0/int.bend&name=Nar.opt) # U8 and U16 hold their value in a U32 below 2^w, and m is 2^w - 1. def Nar.opt(ov: Bool, r: U32) -> Maybe<&2, U32>: Int.Nar.over (https://jend.leeeet.dev/definition.txt?path=bend-kit-int@0.2.0.0/int.bend&name=Nar.over) def Nar.over(+m: U32, +r: U32) -> Maybe<&2, U32>: Int.Nar.checked_sub (https://jend.leeeet.dev/definition.txt?path=bend-kit-int@0.2.0.0/int.bend&name=Nar.checked_sub) def Nar.checked_sub(+a: U32, +b: U32) -> Maybe<&2, U32>: Int.Nar.checked_div (https://jend.leeeet.dev/definition.txt?path=bend-kit-int@0.2.0.0/int.bend&name=Nar.checked_div) def Nar.checked_div(a: U32, +b: U32) -> Maybe<&2, U32>: Int.Nar.checked_mod (https://jend.leeeet.dev/definition.txt?path=bend-kit-int@0.2.0.0/int.bend&name=Nar.checked_mod) def Nar.checked_mod(a: U32, +b: U32) -> Maybe<&2, U32>: Int.Nar.sat_sub (https://jend.leeeet.dev/definition.txt?path=bend-kit-int@0.2.0.0/int.bend&name=Nar.sat_sub) def Nar.sat_sub(lt: Bool, a: U32, b: U32) -> U32: Int.Nar.saturating_sub (https://jend.leeeet.dev/definition.txt?path=bend-kit-int@0.2.0.0/int.bend&name=Nar.saturating_sub) def Nar.saturating_sub(+a: U32, +b: U32) -> U32: Int.Nar.show.go (https://jend.leeeet.dev/definition.txt?path=bend-kit-int@0.2.0.0/int.bend&name=Nar.show.go) # Digits of x in radix r, most significant first; fuel f bounds them. def Nar.show.go(f: Nat, +r: U32, acc: String, z: Bool, +x: U32) -> String: Int.Nar.show (https://jend.leeeet.dev/definition.txt?path=bend-kit-int@0.2.0.0/int.bend&name=Nar.show) def Nar.show(r: U32, x: U32) -> String: Int.Nar.read.dig (https://jend.leeeet.dev/definition.txt?path=bend-kit-int@0.2.0.0/int.bend&name=Nar.read.dig) def Nar.read.dig(ok: Bool, +r: U32, acc: U32, d: U32) -> Maybe<&2, U32>: Int.Nar.read.step (https://jend.leeeet.dev/definition.txt?path=bend-kit-int@0.2.0.0/int.bend&name=Nar.read.step) # acc * r + d stays at most m exactly when acc <= (m - d) / r. def Nar.read.step(+r: U32, +m: U32, st: Maybe<&2, U32>, x: U32) -> Maybe<&2, U32>: Int.Nar.read.go (https://jend.leeeet.dev/definition.txt?path=bend-kit-int@0.2.0.0/int.bend&name=Nar.read.go) def Nar.read.go(s: String, +r: U32, +m: U32, st: Maybe<&2, U32>) -> Maybe<&2, U32>: Int.Nar.read.u (https://jend.leeeet.dev/definition.txt?path=bend-kit-int@0.2.0.0/int.bend&name=Nar.read.u) # Digits in radix r, at most m; no sign. def Nar.read.u(+r: U32, +m: U32, s: String) -> Maybe<&2, U32>: Int.Nar.read.split (https://jend.leeeet.dev/definition.txt?path=bend-kit-int@0.2.0.0/int.bend&name=Nar.read.split) def Nar.read.split(+r: U32, +m: U32, p: Bool & String) -> Maybe<&2, U32>: Int.Nar.read.if (https://jend.leeeet.dev/definition.txt?path=bend-kit-int@0.2.0.0/int.bend&name=Nar.read.if) def Nar.read.if(ok: Bool, +r: U32, +m: U32, s: String) -> Maybe<&2, U32>: Int.Nar.read (https://jend.leeeet.dev/definition.txt?path=bend-kit-int@0.2.0.0/int.bend&name=Nar.read) def Nar.read(+r: U32, +m: U32, s: String) -> Maybe<&2, U32>: Int.S32.MIN (https://jend.leeeet.dev/definition.txt?path=bend-kit-int@0.2.0.0/int.bend&name=S32.MIN) # I32 holds its two's-complement bits in a U32. def S32.MIN() -> U32: Int.S32.is_neg (https://jend.leeeet.dev/definition.txt?path=bend-kit-int@0.2.0.0/int.bend&name=S32.is_neg) def S32.is_neg(x: U32) -> Bool: Int.S32.neg (https://jend.leeeet.dev/definition.txt?path=bend-kit-int@0.2.0.0/int.bend&name=S32.neg) def S32.neg(x: U32) -> U32: Int.S32.neg_if (https://jend.leeeet.dev/definition.txt?path=bend-kit-int@0.2.0.0/int.bend&name=S32.neg_if) def S32.neg_if(c: Bool, x: U32) -> U32: Int.S32.abs (https://jend.leeeet.dev/definition.txt?path=bend-kit-int@0.2.0.0/int.bend&name=S32.abs) def S32.abs(+x: U32) -> U32: Int.S32.cmp (https://jend.leeeet.dev/definition.txt?path=bend-kit-int@0.2.0.0/int.bend&name=S32.cmp) def S32.cmp(a: U32, b: U32) -> Cmp: Int.S32.divmod.if (https://jend.leeeet.dev/definition.txt?path=bend-kit-int@0.2.0.0/int.bend&name=S32.divmod.if) # x / 0 is 0 and x % 0 is x, as in Base's U32. MIN / -1 wraps to MIN. def S32.divmod.if(z: Bool, +a: U32, +b: U32) -> U32 & U32: Int.S32.fst (https://jend.leeeet.dev/definition.txt?path=bend-kit-int@0.2.0.0/int.bend&name=S32.fst) def S32.fst(p: U32 & U32) -> U32: More: https://jend.leeeet.dev/packages/bend-kit-int.txt?definitions_offset=100