From 8b5b472a2de940e857c09712a7dda04c72bab52c Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sat, 22 Aug 2020 14:24:11 +0200 Subject: [PATCH] Optimize read_chunk_header --- libretro-common/formats/png/rpng.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/libretro-common/formats/png/rpng.c b/libretro-common/formats/png/rpng.c index 8831cab5a4..a4aedf288a 100644 --- a/libretro-common/formats/png/rpng.c +++ b/libretro-common/formats/png/rpng.c @@ -955,14 +955,8 @@ static bool read_chunk_header(uint8_t *buf, uint8_t *buf_end, struct png_chunk *chunk) { unsigned i; - uint8_t dword[4]; - dword[0] = '\0'; - - for (i = 0; i < 4; i++) - dword[i] = buf[i]; - - chunk->size = dword_be(dword); + chunk->size = dword_be(buf); /* Check whether chunk will overflow the data buffer */ if (buf + 8 + chunk->size > buf_end)