want fast bit set/extract
bhurt at spnz.org
Tue Apr 20 02:50:32 CEST 2004
On 17 Apr 2004, D. J. Bernstein wrote:
> I often want to compute floor(n/2^s) mod 2^b, given n,b,s. This should
> be extremely fast when b is small (particularly when s is a multiple of
> 32), even if s is somewhere in the middle of the bits of n.
I posted code to do this a while ago, but haven't gotten around to
finishing debugging the mmx version of this code. Actually, the code I
wrote was even more generic than this.
> Similarly, I often want to replace n with n + 2^s m. This should be
> extremely fast (assuming few carries) when m is small and n already has
> enough space allocated.
This wouldn't be hard to modify my code to do. Question: how would you
want to handle the carry out?
"Usenet is like a herd of performing elephants with diarrhea -- massive,
difficult to redirect, awe-inspiring, entertaining, and a source of
mind-boggling amounts of excrement when you least expect it."
- Gene Spafford
More information about the gmp-discuss