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

Re: PO4 bitrev



> I've been working on P04 and the reversing bits section and I'm not getting any errors,
> the code is compiling, but the correct output is not showing up. 

You used the reverse code example which works with arrays, not bits.

I removed that example from the notes to avoid further confusion.

The bit reverse example code is still there at the end of the notes on bitwise operators:

 // r = bits of x in reverse order, n is bit-length of x
 //
   r = 0;  for( i = 0; i < n; ++i) { r <<= 1; r |= x & 1; x >>= 1; }