It turns out that my functions work perfectly fine for uncompressed bitmaps. The image I was testing on was run length encoded. I will probably add support for this since I'm starting to get bothered about how much is being unsupported.