mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-11-01 07:33:12 +08:00
Dividing BigInts of the same limb count, where the quotient is one limb, takes Knuth's quotient estimate from the top limbs as they read normalized and settles it with one pass of a - q * b over the operands, instead of copying both operands shifted and running algorithm D. The remainder, when wanted, is that pass's result. The limb loops for add, subtract, multiply by a limb, and multiply-add and multiply-subtract by a limb process four limbs a pass, with the carries in add-with-carry chains (__builtin_addcll and __builtin_subcll where the compiler has them).