BigInt.div128

private ulong div128(ulong u1, ulong u0, ulong v, out ulong r) static pure nothrow @nogc @trusted

Divides the 128-bit value (u1 << 64 | u0) by v, returning the quotient and setting r to the remainder.

Parameters

u1The high 64 bits of the dividend.
u0The low 64 bits of the dividend.
vThe divisor.
rSet to the remainder.

Returns

The quotient. If v is 0, or the quotient would not fit in 64

bits, both the return value and r are set to ulong.max as an error sentinel (the checked callers avoid these cases).