Int.Int.divmod.if: def of bend-kit-int@0.2.0.0 Import: import bend-kit-int@0.2.0.0/int.bend as Int Lines 134-146 of bend-kit-int@0.2.0.0/int.bend: https://jend.leeeet.dev/read.txt?path=bend-kit-int@0.2.0.0/int.bend&start_line=134&end_line=146 import Base # 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): match z: case True{}: (Word.zero(n), a) case False{}: match s: case True{}: Int.sdivmod.fix(n, Int.msb(n, a), Int.msb(n, b), Int.udivmod.go(n, Int.abs(n, a), n, Int.abs(n, b))) case False{}: Int.udivmod.go(n, a, n, b) Uses (10): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Bool https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Nat https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Pair https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Sigma https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Word https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Word.zero https://jend.leeeet.dev/definition.txt?path=bend-kit-int@0.2.0.0/int.bend&name=Int.abs https://jend.leeeet.dev/definition.txt?path=bend-kit-int@0.2.0.0/int.bend&name=Int.msb https://jend.leeeet.dev/definition.txt?path=bend-kit-int@0.2.0.0/int.bend&name=Int.sdivmod.fix https://jend.leeeet.dev/definition.txt?path=bend-kit-int@0.2.0.0/int.bend&name=Int.udivmod.go