Need help with mpz_t...
Torbjorn Granlund
tg at gmplib.org
Mon Jun 14 10:08:34 CEST 2010
David Cleaver <wraithx at morpheus.net> writes:
I found another way to do this that looks much better in code, but is
about 5x slower in practice:
for (j = 0; j < 64; j++)
{
if (results2[i]&((u64_t)1<<j))
mpz_setbit(my_result, j+64);
if (results1[i]&((u64_t)1<<j))
mpz_setbit(my_result, j);
}/* end for */
Working bit by bit is usually not the best way.
However, if anyone knows of a faster way to do this conversion, I'd
still like to hear about it. Thanks for your time.
I'd use mpz_import.
--
Torbjörn
More information about the gmp-discuss
mailing list