On Fri, May 22, 2009 at 11:29 PM, Craig Citro <[email protected]> wrote: > >> That link no longer works but when I skimmed it early it recommended >> to never use mpz_import and mpz_export. Is there a particular reason? >> (I use both functions in gmpy to convert between the internal >> representation of a Python longint and an mpz.) >> > > We also do the same thing in Sage to convert between a Pari t_INT and > a Sage Integer.
I thought we would be (ab)using the fact that t_INT and a sage Integer both use almost the same representation (Sage uses mpn through mpz, and Pari uses mpn directly). But maybe that's what mpz_import and mpz_export are doing? Could there be a (small) saving in conversion by using memcpy directly? Incidentally, there's code in Sage to convert between mpn/mpz and pylong... but maybe that's also something that mpz_import and mpz_export already do... Gonzalo --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "mpir-devel" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/mpir-devel?hl=en -~----------~----~----~----~------~----~------~--~---
