Palette storage... Shifting...

This is a discussion on Palette storage... Shifting... within the Game Programming forums, part of the General Programming Boards category; 13h game. DJGPP. Windows95
Will someone please explain to me what Brackeen
is doing when he's shifing the return value
...

Is there a specific reason why he's doing this
(as in, does it have to be done in order for
the palette to be stored correctly?), or is
it just for speed? I understand what shifting does,
but I'm not quite comfortable with it, yet.

ultimately it depends upon the context of the program... but it looks to me like he's reading a palette from a 256 color bitmap... and translating 8 bit rgb values to 6 bit... which is what you'd pass to the pallete ports... [you have 2^18 colors... but only 256 indexes for them...]

I thought shifting gave the effect of multiplication
(that's what Brackeen says).

If the Red-value that was read was shifted twice,
wouldn't it be the same as multiplying by four,
instead of dividing. Yeah, I know you're right
(my program even shows that the RGB values were
divided by 4), but why does this work?

If the value that fgetc() returned was shifted
to the left twice, wouldn't that be like saying: