Re: want fast bit set/extract

Kevin Ryde <[email protected]> Sat, 24 Apr 2004 08:00:04 +1000
Newsgroups gmane.comp.lib.gmp.general,gmane.comp.djb.bignum.devel
Message-ID <[email protected]>
"D. J. Bernstein" <[email protected]> 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
objections.

> 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 :-).