Bitshift help.

  b = 1 << 1 | 1;

use instead:

  b = (b << 1) | 1;

to produce 0b00000001 -> 0b00000011 -> 0b00000111 ...

or

  b = (b >> 1) | 0x80;

to produce 0b10000000 -> 0b11000000 -> 0b11100000 ...;

This is also considerably faster.