Request for new functions...
David Cleaver
wraithx at morpheus.net
Sun Dec 23 17:31:18 CET 2012
Hello all,
I would like to ask if we could add new functions to GMP that could benefit
users of LLP64 systems, which right now would probably only be of benefit to
Windows 64-bit users. As it is right now, all of the mpz_*_ui functions take an
unsigned long int as an argument, which is only 32 bits on Win64 systems. This
makes it difficult to combine work with mpz_t's and 64 bit integers in a Win64
environment. I would like to ask if new functions could be added that take
mp_limb_t or mp_limb_signed_t as arguments. This would allow users on Win64
systems to easily work with mpz_t's and 64 bit integers. For example:
void mpz_set_ulimb(mpz_t rop, mp_limb_t op)
mp_limb_t mpz_get_ulimb(mpz_t op)
void mpz_mul_slimb(mpz_t rop, mpz_t op1, mp_limb_signed_t op2)
I also think this would be a good addition to GMP to allow the use of the
largest available native type, without worrying about the name of that type (ie,
long, long long, uint128_t, etc). All that information could be hidden behind
the mp_limb_t type. Then if users need size specific code, they can just check
the sizeof(mp_limb_t).
There may be other advantages, or disadvantages, to adding these functions.
What does everyone here think of these proposed additions? Down below I've
included a list of all the new/proposed mpz C functions. Thank you for your time.
-David C.
List of new mpz C functions:
void mpz_set_ulimb(mpz_t rop, mp_limb_t op)
void mpz_set_slimb(mpz_t rop, mp_limb_signed_t op)
void mpz_init_set_ulimb(mpz_t rop, mp_limb_t op)
void mpz_init_set_slimb(mpz_t rop, mp_limb_signed_t op)
mp_limb_t mpz_get_ulimb(mpz_t op)
mp_limb_signed_t mpz_get_slimb(mpz_t op)
void mpz_add_ulimb(mpz_t rop, mpz_t op1, mp_limb_t op2)
void mpz_sub_ulimb(mpz_t rop, mpz_t op1, mp_limb_t op2)
void mpz_ulimb_sub(mpz_t rop, mp_limb_t op1, mpz_t op2)
void mpz_mul_ulimb(mpz_t rop, mpz_t op1, mp_limb_t op2)
void mpz_mul_slimb(mpz_t rop, mpz_t op1, mp_limb_signed_t op2)
void mpz_addmul_ulimb(mpz_t rop, mpz_t op1, mp_limb_t op2)
void mpz_submul_ulimb(mpz_t rop, mpz_t op1, mp_limb_t op2)
mp_limb_t mpz_cdiv_q_ulimb(mpz_t q, mpz_t n, mp_limb_t d)
mp_limb_t mpz_cdiv_r_ulimb(mpz_t r, mpz_t n, mp_limb_t d)
mp_limb_t mpz_cdiv_qr_ulimb(mpz_t q, mpz_t r, mpz_t n, mp_limb_t d)
mp_limb_t mpz_cdiv_ulimb(mpz_t n, mp_limb_t d)
mp_limb_t mpz_fdiv_q_ulimb(mpz_t q, mpz_t n, mp_limb_t d)
mp_limb_t mpz_fdiv_r_ulimb(mpz_t r, mpz_t n, mp_limb_t d)
mp_limb_t mpz_fdiv_qr_ulimb(mpz_t q, mpz_t r, mpz_t n, mp_limb_t d)
mp_limb_t mpz_fdiv_ulimb(mpz_t n, mp_limb_t d)
mp_limb_t mpz_tdiv_q_ulimb(mpz_t q, mpz_t n, mp_limb_t d)
mp_limb_t mpz_tdiv_r_ulimb(mpz_t r, mpz_t n, mp_limb_t d)
mp_limb_t mpz_tdiv_qr_ulimb(mpz_t q, mpz_t r, mpz_t n, mp_limb_t d)
mp_limb_t mpz_tdiv_ulimb(mpz_t n, mp_limb_t d)
mp_limb_t mpz_mod_ulimb(mpz_t r, mpz_t n, mp_limb_t d)
void mpz_divexact_ulimb(mpz_t q, mpz_t n, mp_limb_t d)
int mpz_divisible_ulimb_p(mpz_t n, mp_limb_t d)
int mpz_congruent_ulimb_p(mpz_t n, mp_limb_t c, mp_limb_t d)
/* Exponentiation Functions, probably do not need ulimb versions */
mp_limb_t mpz_gcd_ulimb(mpz_t rop, mpz_t op1, mp_limb_t op2)
void mpz_lcm_ulimb(mpz_t rop, mpz_t op1, mp_limb_t op2)
int mpz_kronecker_slimb(mpz_t a, mp_limb_signed_t b)
int mpz_kronecker_ulimb(mpz_t a, mp_limb_t b)
int mpz_slimb_kronecker(mp_limb_signed_t a, mpz_t b)
int mpz_ulimb_kronecker(mp_limb_t a, mpz_t b)
void mpz_fac_ulimb(mpz_t rop, mp_limb_t n)
void mpz_2fac_ulimb(mpz_t rop, mp_limb_t n)
void mpz_mfac_ulimb_ulimb(mpz_t rop, mp_limb_t n, mp_limb_t m)
void mpz_primorial_ulimb(mpz_t rop, mp_limb_t n)
void mpz_bin_ulimb(mpz_t rop, mpz_t n, mp_limb_t k)
void mpz_bin_ulimb_ulimb(mpz_t rop, mp_limb_t n, mp_limb_t k)
void mpz_fib_ulimb(mpz_t fn, mp_limb_t n)
void mpz_fib2_ulimb(mpz_t fn, mpz_t fnsub1, mp_limb_t n)
void mpz_lucnum_ulimb(mpz_t ln, mp_limb_t n)
void mpz_lucnum2_ulimb(mpz_t ln, mpz_t lnsub1, mp_limb_t n)
int mpz_cmp_slimb(mpz_t op1, mp_limb_signed_t op2)
int mpz_cmp_ulimb(mpz_t op1, mp_limb_t op2)
int mpz_cmpabs_ulimb(mpz_t op1, mp_limb_t op2)
int mpz_fits_ulimb_p(mpz_t op)
int mpz_fits_slimb_p(mpz_t op)
/* perhaps additional functions for mpq and mpf types */
More information about the gmp-discuss
mailing list