New or modified function
tg at gmplib.org
Thu Nov 19 14:08:37 CET 2009
I am prettu sure (a/g)*(b/g) is the right approach, always, if one could
take advantage of g's invariance over two divisions. Unfortunately,
interfaces for taking advantage of divisor invariance are unavailable in
Using internal interfaces:
If g is just a word, on would use invert_limb, then mpn_preinv_divrem_1
(which indidentally is obsolete, and will soon be replaced).
Or, if a/g and b/g are known to be integers, use binvert_limb and
mpn_bdiv_q_1_pi1 (preliminary name, likely to change...).
If g is more than one word, shift it left so that its most significant
bit becomes 1, shift a and b the same number of bit positions (possibly
introducing a new high word), then call mpn_sbpi1_div_q.
Or, again if a/g and b/g are known to be integers, use the bdiv
This is tricky, and *unsupported*. Division in mpn is in flux, but will
in a future release be documented and somewhat orthogonal.
More information about the gmp-discuss