Lazy mpz allocation

Marco Bodrato bodrato at mail.dm.unipi.it
Fri Apr 20 06:17:42 UTC 2018


Ciao,

Il Gio, 19 Aprile 2018 4:37 pm, Marc Glisse ha scritto:
> I finally pushed it. It seemed unsafe to keep mpq unaware of lazy
> allocation, in case people start swapping the numerator of a rational with
> a lazy 0 integer or something like that.

If we fear swaps, then ... what about swapping the deoniminator?

Should we support a code like:

  mpz_init (saved_denominator);
  mpz_swap (saved_denominator, mpq_denref(rational));
  /* Code overwriting rational*/

?

If yes, a larger patch is needed, I attach a proposal.

Ĝis,
m

-- 
http://bodrato.it/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: gmp.diff
Type: text/x-patch
Size: 4775 bytes
Desc: not available
URL: <https://gmplib.org/list-archives/gmp-devel/attachments/20180420/c8d4e5bf/attachment.bin>


More information about the gmp-devel mailing list