want fast bit set/extract

Kevin Ryde user42 at zip.com.au
Sat Apr 24 00:00:04 CEST 2004

"D. J. Bernstein" <djb at cr.yp.to> writes:
>    void mpz_copybits_fdiv(
>      mpz_t rop,unsigned long t,
>      mpz_t op,unsigned long s,
>      unsigned long b)

Yes, something like that.  I guess block set and clear would also be
of value.  I'll add something to the tasks list if Torbjorn has no

> An mpz_copybits_tdiv---which would be faster for negative numbers, and
> simpler, with your current integer representation---would be fine for
> typical applications. I suggested fdiv above because you seem to have
> mpz_tstbit = mpz_tstbit_fdiv, etc., without tdiv versions.

Yes, "emulated" twos-complement is the convention on the bitwise
things.  Though it's a bit like hard work, and I'm not even sure if it
finds much genuine use.  (There must have been a good reason it was
adopted in the first place, but I don't know what it was :-).

More information about the gmp-discuss mailing list