Int.S32.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 606-614 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=606&end_line=614 import Base # 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: match z: case True{}: (0, a) case False{}: (S32.neg_if(Bool.xor(S32.is_neg(a), S32.is_neg(b)), U32.div(S32.abs(a), S32.abs(b))), S32.neg_if(S32.is_neg(a), U32.mod(S32.abs(a), S32.abs(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=Bool.xor 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=U32 https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32.div https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32.mod https://jend.leeeet.dev/definition.txt?path=bend-kit-int@0.2.0.0/int.bend&name=S32.abs https://jend.leeeet.dev/definition.txt?path=bend-kit-int@0.2.0.0/int.bend&name=S32.is_neg https://jend.leeeet.dev/definition.txt?path=bend-kit-int@0.2.0.0/int.bend&name=S32.neg_if