I have a weird problem. I'm making a LoadBMP function for the graph unit and as you may know, 1 and 4 bit bmp files can hold multiple pixels in a byte. I must read 1 pixel at a time so I used a loop and Shr and Shl to get what I need.

but I got a problem:

( FF (11111111) shl 0 ) shr 4 >> 0F (00001111) - this was fine for me, but

( FF (11111111) shl 4 ) shr 4 >> FF (11111111) - why is this so? I thought the result would be 0F again.

Does freepascal *save* the shifted bits?

I thought they get deleted, but it got them back. Can someone explain please !