New function mpz_init_setbit
marco.bodrato at tutanota.com
marco.bodrato at tutanota.com
Thu Jun 25 17:40:06 CEST 2026
Ciao Torbjörn,
25 giu 2026, 16:18 da tg at gmplib.org:
> marco.bodrato at tutanota.com writes:
>
> Do you mind if I add a new function?
>
> Here is its implementation:
>
> /* mpz_init_setbit(integer, val) -- Initialize and assign INTEGER with 2^VAL. */
> void
> mpz_init_setbit (mpz_ptr dest, mp_bitcnt_t bit_idx)
>
>
> I suppose that the name should be mpz_set_2exp, for consistency?
>
I think that every function that initialize an mpz_t should have mpz_init_ as a prefix.
And since mpz_init_setbit would be equivalent to mpz_init followed by mpz_setbit,
I proposed this name.
But you remind me also that I'd also like to add a couple of functions:
mpz_addmul_2exp, and mpz_submul_2exp.
But I should implement them... someday, maybe.
Ĝis,
m
--
DC: https://vado.li/dc-bodrato
More information about the gmp-devel
mailing list