mpz_combit
Torbjorn Granlund
tg at gmplib.org
Fri Dec 28 09:45:37 CET 2012
nisse at lysator.liu.se (Niels Möller) writes:
bodrato at mail.dm.unipi.it writes:
> About mpz_combit code, may I suggest replacing the two lines
> MPN_NORMALIZE (dp, dsize);
> ASSERT (dsize > 0);
> with
> MPN_NORMALIZE_NOT_ZERO (dp, dsize);
> ?
Conciseness is nice. Is that equivalent? I had some impression that the
latter is less safe, but that may be completely wrong.
With --enable-assert, I think the alternative statements are equivalent.
Without --enable-assert, when dsize = 0, the former will scan zero limbs
and end up with dsize = 0, while the latter will scan into limbo.
If things go havoc for dsize = 0 for other reasons, then the two
variations will be effectively equivalent even without --enable-assert.
--
Torbjörn
More information about the gmp-devel
mailing list