want fast bit set/extract
D. J. Bernstein
djb at cr.yp.to
Sat Apr 17 04:45:45 CEST 2004
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.
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.
Please support these two operations! These are _much_ more useful than
isolated right-shift/left-shift operations.
I'm sending this note to the mailing lists for bignum implementors, for
the leading C bignum software, and for the leading C++ bignum software.
http://www.swox.com/list-archives/gmp-discuss/2004-March/001031.html
already explains one of the ways that these operations are used.
---D. J. Bernstein, Associate Professor, Department of Mathematics,
Statistics, and Computer Science, University of Illinois at Chicago
More information about the gmp-discuss
mailing list