I have some functions that read, write, and display bitmaps. My problem is that I can't seem to get the padding right for 16 color bitmaps. I first tried calculating with (4-width%4) & 3. However, this fails sometimes. I'm not sure whether my algorithm is wrong or what else it could be. Suggestions?