Whoops ....

I was looking at the bit stream without comparing it to your text. The least significant (zero) bit for binary numbers is typically at the right end, and are read right to left. So the binary number 10110 has bits 1, 2 and 4 set. To set p1, p3 and p4 you would set bits 0, 2 and 3 (or, 01101). Confusing, but that's what computers are for :-)

Tim