Initialise an integer with all bits set to 1.

Sisyphus kalinabears@iinet.net.au
Sun, 29 Jun 2003 14:33:55 +1000


Hi,
At the moment I'm initialising the integer to zero with
mpz_init2() and then looping through each bit and setting it to 1 with
mpz_setbit().

This works fine, but looks a little inefficient (not to mention ridiculous -
especially if there's a way of doing it limb-by-limb, rather than
bit-by-bit).

What's the recommended method of doing this ?

Cheers,
Rob