diff --git a/Source/Core/VideoCommon/HiresTextures.cpp b/Source/Core/VideoCommon/HiresTextures.cpp index 6362636387..9df399365f 100644 --- a/Source/Core/VideoCommon/HiresTextures.cpp +++ b/Source/Core/VideoCommon/HiresTextures.cpp @@ -243,10 +243,11 @@ std::string HiresTexture::GenBaseName(const u8* texture, size_t texture_size, co } break; case 16384 * 2: - for (size_t i = 0; i < texture_size / 2; i++) + for (size_t i = 0; i < texture_size; i += sizeof(u16)) { - min = std::min(min, Common::swap16(((u16*)texture)[i]) & 0x3fff); - max = std::max(max, Common::swap16(((u16*)texture)[i]) & 0x3fff); + const u16 texture_halfword = Common::swap16(texture[i]) & 0x3fff; + min = std::min(min, texture_halfword); + max = std::max(max, texture_halfword); } break; }