Convert a number to base 173
bodrato at mail.dm.unipi.it
bodrato at mail.dm.unipi.it
Mon May 21 08:36:20 CEST 2012
Ciao,
Il Dom, 20 Maggio 2012 10:03 pm, Di Maria Giovanni ha scritto:
> Using the low leve function "mpn_get_str", if the limb is 1, it works
WARNING: remember that you must know what you are doing, when you use low
level functions!
> mp_limb_t indirizzo;
...
> bytes_scritti=mpn_get_str(v,173,&indirizzo,lunghezza);
Whatever you wrote in the ellipses (...), you are giving to the function
"mpn_get_str" the address of the variable "indirizzo". That variable is of
type "mp_limb_t", therefor it can contain at most one limb. It will work
if and only if lunghezza==1.
To be honest, I do not remember if there is a documented way to access the
mpn_t underlying an mpz_t. You may look at the "Internal" chapter of the
manual at http://gmplib.org/manual/Internals.html#Internals , but it
warns: "internals described here may change in future GMP releases".
Regards,
Marco
--
http://bodrato.it/papers/
More information about the gmp-discuss
mailing list