Best way to import without copy
Marc Glisse
marc.glisse at inria.fr
Thu May 4 00:25:06 CEST 2023
On Wed, 3 May 2023, Julien D Arques wrote:
> I currently use mpz_import, but reading the source code, it appears that
> gmp copies the already allocated buffer I give it.
> That's double the work, and the said buffer is big.
Depending on endianness and other criteria, this might not be a simple
copy.
> Is there a correct/reliable way to avoid that?
If you are certain the format is right, you could try mpz_roinit_n.
--
Marc Glisse
More information about the gmp-discuss
mailing list