Testing Integers - Individual Limb values
Jim White
mathimagics at yahoo.co.uk
Tue Jun 6 02:33:07 CEST 2006
> For examle, one of the functions is testing the
> 1024th bit of an integer number. I could use the
> standard gmp bit functions, but why not simply
> read the 32nd limb (bits per limb are equal
> to 32 on my system) and then get its
> msb.
Accessing individual limbs is simple, but the GMP
functions use that simple method anyway, so why
bother?
If you want to do it yourself, assuming BYTE
addressing, if P is the pointer to the limbs, and S is
the current size, in limbs, then the address of the
most-significant limb is P + 4(S-1), then subtract 4
for the next limb, and so on....
Jim White
ANU, Canberra
More information about the gmp-discuss
mailing list