_mp_alloc vs ALLOC

Niels Möller nisse at lysator.liu.se
Fri Feb 24 10:01:23 CET 2012


Torbjorn Granlund <tg at gmplib.org> writes:

> Surely a plain TMP_ALLOC adds red zones?  If not, that is something we
> ought to fix.

But

  tp = TMP_ALLOC_LIMBS (2*n);
  xp = tp + n;

does not add any between T and X (intended to hold n limbs each). So if
one doesn't use TMP_ALLOC_LIMBS_2, one should instead write

  tp = TMP_ALLOC_LIMBS (n);
  xp = TMP_ALLOC_LIMBS (n);

to get red zones for this common case. Right?

Maybe this is more overhead, in the non-debug case, than using
TMP_ALLOC_LIMBS_2. I'm not sure.

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