Lazy mpz allocation

Niels Möller nisse at lysator.liu.se
Wed May 4 13:32:42 UTC 2016


Marc Glisse <marc.glisse at inria.fr> writes:

> That looks pretty much like the copy-on-write thing you and Marco were
> discussing last year

Exactly, thanks for digging it up. And quoting Marco
(https://gmplib.org/list-archives/gmp-devel/2015-September/004167.html),
here's the main drawback

: E.g. mpz_combit starts with:
: 
:   if (limb_index + 1 < SIZ(x)) {
:     PTR(x)[limb_index] ^= bit;
:     return;
:   }
: 
: If we allow the ALLOC(x)==0 && SIZ(x) != 0 case, we need to insert a check
: also in the simpler cases...

Not sure how painful it would be to fix copy-on-write in all those
places.

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