Re: Non-polaroid Sonar Adam Oliver wrote:
> Just so I'm clear, ref pink book page 10-17.
> Does the "bit_set( 0x1021, 1 );" refer to bit 0 -EDG3B, and
> bit_clear( 0x1021, 2 ); " refer to bit 1 -EDG3A.
> This is what was throwing me, I always thought bits started at zero and
> ended at 7, not 1 to 8 as appears to be the case here. Is this what the
> "zero-indexed " means?
>
> sorry if it's a basic question, but if you don't ask you never learn :-)

No, that's a very good question. It had me confused, too. The second argument to bit_set and bit_clear is not actually the index of a bit at all; it's a bit mask.

For example, when you do bit_set( 0x1021, 3 ), the 3 becomes 0000 0011 in binary, so it will set the last two bits of the address. Hope this helps!

-- Will

