Functions variants

Torbjorn Granlund tg at gmplib.org
Sat Apr 9 16:02:20 CEST 2011


Daniele Varrazzo <daniele.varrazzo at gmail.com> writes:

  Are the _ui variants of the functions just a convenience wrapper to
  simplify writing C code without allocation/initialization of one of
  the arguments, or are they wrapper for a implementation faster than
  the algorithms used in the more generic case?

The _ui variants are faster iff an argument is an 'unsigned long'.  It
will then save the time to assign the unsigned long to an mpz_t
variable, and perhaps for mpz_init/mpz_clear.

If the value is already in an mpz_t, you should not extract it and call
an _ui function.

-- 
Torbjörn


More information about the gmp-discuss mailing list