How large are arbitrarily large integers? (Was Re: Bitfield subtlety)

Torbjörn Granlund tg at
Fri Mar 30 13:59:01 UTC 2018

paul zimmermann <Paul.Zimmermann at> writes:

  1) if 0, the 30 bits are interpreted as a size between 0 and 2^30-1
  2) if 1, the 30	bits are split into say 24 significand bits and 6
     exponent bits, which would be enough up to 2^87 with an overhead of
     less than 1e-6

That proposal has one positive effect and one negative.

The positive effect is that almost all allocations will use the
small-operands format.

The negative is that this seem to add another branch for reallocation
checks.  While it is highly predicatble, meaning that the processor with
enough prediction bits will not lose much time, I prefer to minimise
non-loop branches in the GMP execution flow.

(Besides, we don't want to extend the allocation only, we need to give
bits to the size field.)

Please encrypt, key id 0xC8601622

More information about the gmp-devel mailing list