[Courses] Re: [C] My Life program...

Julie txjulie at austin.rr.com
Fri Jul 26 12:43:37 EST 2002


Cynthia Grossen wrote:
> 
> array[bit/8] &= ~(1<<(bit%8));
> 
> This line strikes me as really intense. It seems like there's so much going
> on here.
> My interpretation of the line is:
> Do a bitwise AND on the array at position bit/8 with the bitwise complement
> of 1 left-shifted bit%8 positions.
> Is this a correct interpretation?

Abstractly speaking, it's "turn off the bit" where "array" is being
regarded as a bit string stored in an array of 8 bit char's.

For extra credit, if instead of single bits, each object were 3
bits wide, and the bit string was stored in 32 bit unsigned
integers, how would you turn off object 'n'?
-- 
Julianne Frances Haugh             Life is either a daring adventure
txjulie at austin.rr.com                  or nothing at all.
					    -- Helen Keller



More information about the Courses mailing list