nisse at lysator.liu.se
Fri Jul 15 21:12:54 UTC 2016
paul zimmermann <Paul.Zimmermann at inria.fr> writes:
> would it be possible to add mpn_invert_limb in the public interface?
> It would be very useful for GNU MPFR.
Makes sense to me, it's a useful and well-defined operations, and
discussed at length in various papers. So should be quite easy to
As far as I understand, it's not always compiled into the library,
though. Internally the code uses the macro invert_limb, which expands to
a call to mpn_invert_limb only if there exists a native implementation,
otherwise, the macro expands to a call to udiv_qrnnd.
Not sure if there's any problem with always making mpn_invert_limb a
real function and call it explicitly. In the cases where it expands to
udiv_qrnnd, it's probably so slow that an extra level of function call
shouldn't matter much.
Looking at longlong.h, there appears to be some cases where udiv_qrnnd
is in turn defined as mpn_invert_limb + udiv_qrnnd_preinv (not entirely
clear when that might happen, seems possible only for alpha, arm, cray,
and ia64). And there's some room for cleanup in longlong.h, for example
a few #if 0, and some constants (UMUL_TIME and UDIV_TIME) which are no
longer used, as far as I can see, and most recently mentioned in
ChangeLog back in 2002.
Niels Möller. PGP-encrypted email is preferred. Keyid C0B98E26.
Internet email is subject to wholesale government surveillance.
More information about the gmp-devel