bodrato at mail.dm.unipi.it writes: Inspired from mpz/mul.c... Maybe we can write a macro based on: (*__gmp_free_func) (PTR(x), ALLOC (x) * BYTES_PER_MP_LIMB); ALLOC (x) = newsize; PTR(x) = (mp_ptr) (*__gmp_allocate_func) (newsize * BYTES_PER_MP_LIMB); That's another possibility. -- Torbjörn