mpz_export to file?

Torbjörn Granlund tg at
Wed Dec 9 17:46:43 UTC 2015

paul zimmermann <Paul.Zimmermann at> writes:

  maybe, what would be the interface for the GMP user?
Something like:

  addr = mmap (NULL, len, PROT_WRITE, MAP_SHARED, fd, 0);
  if (addr == 0) error...

  mpz_export (addr, ...);

But frankly, I don't think this will make a very efficient interface,
nor syntactically particularly appealing.

A huge map will cause a system to thrash, since it cannot communicate to
the system that data is not to be reused.  Plain I/O will not ask for
quite that much memory.

We need to work on raw I/O.  The present functions
mpz_out_raw/mpn_inp_raw have a 32-byte limitation.  And wqe lack raw I.O
for mpf.

Please encrypt, key id 0xC8601622

More information about the gmp-devel mailing list