Minor optimization: Help stupid compilers avoid a division (and a multiplication).

This commit is contained in:
Henrik Rydgard committed 2015-07-22 21:03:27 +02:00
1 parent 1c8bae0925
commit ea33f50a8a
1 file changed
+2 -2
+2 -2
View File
@@ -881,7 +881,7 @@ void TextureCache::LoadClut() {
void TextureCache::UpdateCurrentClut() {
const GEPaletteFormat clutFormat = gstate.getClutPaletteFormat();
const u32 clutBase = gstate.getClutIndexStartPos();
const u32 clutBaseBytes = clutBase * (clutFormat == GE_CMODE_32BIT_ABGR8888 ? sizeof(u32) : sizeof(u16));
const u32 clutBaseBytes = clutFormat == GE_CMODE_32BIT_ABGR8888 ? (clutBase * sizeof(u32)) : (clutBase * sizeof(u16));
// Technically, these extra bytes weren't loaded, but hopefully it was loaded earlier.
// If not, we're going to hash random data, which hopefully doesn't cause a performance issue.
//
@@ -895,7 +895,7 @@ void TextureCache::UpdateCurrentClut() {
// Avoid a copy when we don't need to convert colors.
if (UseBGRA8888() || clutFormat != GE_CMODE_32BIT_ABGR8888) {
const int numColors = clutMaxBytes_ / (clutFormat == GE_CMODE_32BIT_ABGR8888 ? sizeof(u32) : sizeof(u16));
const int numColors = clutFormat == GE_CMODE_32BIT_ABGR8888 ? (clutMaxBytes_ / sizeof(u32)) : (clutMaxBytes_ / sizeof(u16));
ConvertColors(clutBufConverted_, clutBufRaw_, getClutDestFormat(clutFormat), numColors);
clutBuf_ = clutBufConverted_;
} else {