bit.div.div_stepΒΆ
One step of bit-level long division: R[0] ^= N; then if R[:n] >= D[:n], do R -= D and toggle Q[0]. The inner loop of bit.div / bit.idiv.
SignatureΒΆ
def div_step n, N, D, R, Q @ do_sub, end { ... }
Defined in bit/div.fj β lines 137β144 (view on GitHub).
ComplexityΒΆ
Time:
n(10@+20)Space:
n(11@+22)
See the complexity glossary for what @, w, dw, dbit, n mean.
SourceΒΆ
Click to view the macro body
def div_step n, N, D, R, Q @ do_sub, end {
..xor R, N
..cmp n, R, D, end, do_sub, do_sub
do_sub:
..sub n, R, D
..not Q
end:
}
Depends onΒΆ
β Previous: bit.div
Next: bit.idiv_loop β