mpz_addmul_ui with ui = 1

Richard B. Kreckel kreckel at
Sat Jan 31 00:00:51 CET 2009


Paul Zimmermann wrote:
> an alternate trick is to store in the mpz_t *pointer* a value of the form
> p=2k+1, where k is a small integer. Since pointers are usually even, you
> can easily distinguish between small integers and GMP integers,
> and you obtain the value k = p >> 1. It is also more memory-efficient since
> you don't allocate the mpz_t structure. A famous computer algebra system is
> using that trick together with GMP.
> It might make sense to have another layer on top of mpz with that trick.

Paul, you want to re-implement CLN fixnums and bignums!?!
<>, page 8.

Richard B. Kreckel

More information about the gmp-discuss mailing list