"Richard G. Riley" <> writes:
> But any techniques for doing the standard bit fiddles without
> occurring extra unnecessary cpu bandwidth would be nice. By standard
> bit fiddles I mean : shift & rotate, anding, oring, shift til bit
> found etc. The operations will be occurring on sequences of
> words and the smallest word will be the standard CPU word size (32
> bits). By sequences of words : I might, for example, be locating
> the first non zero bit from the left in sequence of 64 words.
Slightly off-topic, POSIX has ffs(), which returns the index of the
first non-zero bit in an int. Compare each int with zero, in
sequence, and sic ffs() at the first non-zero one. Presumably, your
implementation will translate the call to ffs() into the most
efficient instruction sequence for your platform; on some systems, it
maps to a single CPU instruction.
As for regular "shift & rotate, anding, oring", if your implementation
does not translate the equivalent C operators into efficient machine
code, you'd better find another one that does.
DES
--
Dag-Erling Smørgrav -