saghmos at xter.net
Thu Sep 1 09:31:02 CEST 2005
I've been reading the mpf_div_ui() code and was surprised to find out
that even though tune was enabling preinv division, the code was NOT
using the mpn_preinv_divrem_1 function.
I thought may be I could modify it to see if I could get any speed out
of it. Unfortunately, I failed.
As I understand it, mpn_preinv_divrem_1 will multiply by (1/x <<
shift_bits) -the preinv value- then do a (>> shift_bits) on the result.
Obviously this assumes an intermediate value that has twice the bits of
a single limb. I've tried this and it failed. I tried reading the code
and looking for examples, but the clues didn't help either.
What I don't understand is, for example, why in get_str.c the
pre-computed tables of base 10 has an inverted-base value that is NOT
(1/<divisor> << normalization_shift). In fact I don't know how the
numbers in the pre-computed base-tables were calculated.
Since mpn_preinv_divrem_1 is only used by get_str, should I assume that
it doesn't offer much benefit over mpn_divrem_1? Or is it not finalized?
Any comments will help.
Thanks in advance,
More information about the gmp-discuss