GMP is a fast arbitrary precision maths library. I use it for integer arithmetic.
There are many functions for integer divisions and remainders, but I'm missing
unsigned long int mpz_tdiv_r_2exp_ui(const mpz_t n, mp_bitcnt_t b)
Is there any reason why it's not there?
And btw, why does the existing
unsigned long int mpz_tdiv_r_ui(mpz_t r, const mpz_t n, unsigned long int d);
require mpz_t r as the argument to take the result, while the result is guaranteed to fit into an unsigned long int AND this is already returned? That seems to be an unnecessary performance loss. (Just note that the doc is wrong in "in fact returning the remainder is all the div_ui functions do". That's wrong, because mpz_tdiv_r_ui() also modifies r (as you would expect)).
Is there any reason for these odd things? If not, then I'll make a change request.