Is there a way to get the number of bits in an mpz_t?

Sisyphus sisyphus1 at optusnet.com.au
Tue Sep 22 09:51:28 CEST 2009


----- Original Message ----- 
From: "Chris Saunders" <evas at mountaincable.net>

> I'm looking for a method to get the number of bits in an mpz_t.  Thanks 
> for any assistence.

Hi Chris,

'mpz_sizeinbase(op, 2);' will return that.
See 
http://gmplib.org/manual/Miscellaneous-Integer-Functions.html#index-mpz_005fsizeinbase-463

Cheers,
Rob



More information about the gmp-discuss mailing list