[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Dr. Dobbs Dev. Update 1/5 July 94 & Schneier



At 01:00 1994/07/03 -0400, tim werner wrote:
>This instruction would be useful in all sorts of applications.  I was just
>wishing I had such a thing only last week.  I had to write a little loop to
>check the number of bits set in a word.  Each bit represented an action,
>and in my particular case it was an error if more than 1 action was
>requested.  The loop was really a waste when you consider that it could
>have been done in 1 instruction.
>
>tw
In C, {int j... if(j & (j-1)) not_exactly_one_bit; ...}