Make BMP processing functions cross-platform