Why set zero in zero.c rather than use xor_n

Niels Möller nisse at lysator.liu.se
Mon Feb 5 20:59:55 UTC 2018


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

> Supposedly, for small sizes, mpn_zero can have a smaller overhead than
> memset, since it has more alignment information. But I don't think
> I've ever used mpn_zero...

I think recent gcc propagates alignment info down the callgraph. So
maybe it could produce a call to a memset entry point which can assume
sizeof(mp_limb_t) alignment? But then we're getting into magic in the
compiler/libc boundary.

We also have a few calls MPN_FILL (p, n, GMP_NUMB_MAX). These are
convertible to memset only if we have no nail bits.

Regards,
/Niels

-- 
Niels Möller. PGP-encrypted email is preferred. Keyid 368C6677.
Internet email is subject to wholesale government surveillance.


More information about the gmp-devel mailing list