Rshift

Will Galway galway at math.uiuc.edu
Sat Oct 29 16:18:31 CEST 2005


Gabriele, I suggest that you use the mpz_tdiv_q_2exp function (or one
of the other "2exp" functions described in the "Integer Division"
section of the GMP manaul).  The "mpz" functions are MUCH easier to
use than the mpn functions, and if your integers are at all large
(more than 200 bits, as a guess) then mpz functions should be nearly
as fast as what mpn functions can provide.

-- Regards, Will
( mailto:galway at math.uiuc.edu  http://www.math.uiuc.edu/~galway )

On Saturday October 29, 2005 at 14:49:34, GabrieleMartino wrote:
 > Hi,
 > 
 > thanks for your answer.
 > I have pdf manual but im not able to use this function.
 > 
 > I have a mpz_t variable and i want to shift it.
 > 
 > mpz_t e;
 > 
 > mpz_init_set_str(e,"65536",10);
 > 
 > The prototype of mpn_rshift is 
 > 
 > mp_limb_t mpn_rshift (mp limb t *rp, const mp limb t *sp, mp size t n,
 > unsigned int count)
 > 
 > How can i get the parameters "mp_limb_t *rp", "const mp_limb_t *sp", "mp_size_t
 > n" ???
 > 
 > Then, how can I obtain the shifted value in mpz_t notation??
 > 
 > Thanks.
 > Gabriele Martino
 > 
 > 
 > _______________________________________________
 > gmp-discuss mailing list
 > gmp-discuss at swox.com
 > https://gmplib.org/mailman/listinfo/gmp-discuss


More information about the gmp-discuss mailing list