diff --git a/libretro-common/formats/png/rpng.c b/libretro-common/formats/png/rpng.c index 55414c71f0..c958ef833b 100644 --- a/libretro-common/formats/png/rpng.c +++ b/libretro-common/formats/png/rpng.c @@ -299,16 +299,20 @@ static void png_reverse_filter_copy_line_gray_alpha(uint32_t *data, const uint8_t *decoded, unsigned width, unsigned bpp) { - uint32_t *data_ptr = NULL; + unsigned i; bpp /= 8; - for (data_ptr = &data[0]; data_ptr < data + width; data_ptr++) + for (i = 0; i < width; i++) { - uint32_t gray = *(decoded); - uint32_t alpha = *(decoded + bpp); - decoded += (2 * bpp); - *data_ptr = (gray * 0x010101) | (alpha << 24); + uint32_t gray, alpha; + + gray = *decoded; + decoded += bpp; + alpha = *decoded; + decoded += bpp; + + data[i] = (gray * 0x010101) | (alpha << 24); } }