mpn_cnd_add_n

Niels Möller nisse at lysator.liu.se
Wed Mar 13 15:25:23 CET 2013


nisse at lysator.liu.se (Niels Möller) writes:

> I plan to check this in fairly soon.

Checked in this renaming now.

Next, I'd like to make mpn_cnd_add_n, mpn_cnd_sub_n and mpn_zero_p
public (I guess that also implies some documentation...).

mpn_zero_p is an inline function. In gmp.h, setting up inlining looks
pretty hairy, with __GMP_EXTERN_INLINE defined in a couple of different
ways depending on compiler.

On the other hand, gmp-impl.h seems to simply use static inline,
unconditionally. If this is good enough for all supported compilers,
maybe it's good enough also in gmp.h? Potential problems:

* We may still need some __GMP_FORCE_* logic for binary compatibility
  with applications which expect the functions to be exported.

* We might break pointer equality (different compilation units might get
  different copies of non-inlined versions). I haven't thought very
  carefully about it, but I guess we already have that problem for
  compilers where __GMP_EXTERN_INLINE expands to static inline (DEC,
  SCO, and SunPro C compilers). If it is a problem. I think this can be
  worked around with some macro indirection to make sure that pointers
  will refer to a unique function in the library.

Anyway, unless someone things cleaning this up now is important, I guess
I'll try to do mpn_zero_p in the same way as other inline functions in
gmp.h.

Regards,
/Niels

-- 
Niels Möller. PGP-encrypted email is preferred. Keyid C0B98E26.
Internet email is subject to wholesale government surveillance.


More information about the gmp-devel mailing list