From 3216040bfe5646f68c34edf5ea05ed3d194396ce Mon Sep 17 00:00:00 2001
From: Lioncash <mathew1800@gmail.com>
Date: Tue, 31 Aug 2021 09:55:13 -0400
Subject: [PATCH] MMU: Remove implicit sign conversions and truncation in
 UpdateTLBEntry

These are trivial to resolve.

Converting the structure member into a u32 results in no increase in
structure size, as it's making use of the three extra padding bits in
the structure.
---
 Source/Core/Core/PowerPC/MMU.cpp   | 4 ++--
 Source/Core/Core/PowerPC/PowerPC.h | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/Source/Core/Core/PowerPC/MMU.cpp b/Source/Core/Core/PowerPC/MMU.cpp
index c4da0bef40..abdcbf67c7 100644
--- a/Source/Core/Core/PowerPC/MMU.cpp
+++ b/Source/Core/Core/PowerPC/MMU.cpp
@@ -1282,9 +1282,9 @@ static void UpdateTLBEntry(const XCheckTLBFlag flag, UPTE_Hi pte2, const u32 add
   if (IsNoExceptionFlag(flag))
     return;
 
-  const int tag = address >> HW_PAGE_INDEX_SHIFT;
+  const u32 tag = address >> HW_PAGE_INDEX_SHIFT;
   TLBEntry& tlbe = ppcState.tlb[IsOpcodeFlag(flag)][tag & HW_PAGE_INDEX_MASK];
-  const int index = tlbe.recent == 0 && tlbe.tag[0] != TLBEntry::INVALID_TAG;
+  const u32 index = tlbe.recent == 0 && tlbe.tag[0] != TLBEntry::INVALID_TAG;
   tlbe.recent = index;
   tlbe.paddr[index] = pte2.RPN << HW_PAGE_INDEX_SHIFT;
   tlbe.pte[index] = pte2.Hex;
diff --git a/Source/Core/Core/PowerPC/PowerPC.h b/Source/Core/Core/PowerPC/PowerPC.h
index b0d5d18b46..db1fc04de5 100644
--- a/Source/Core/Core/PowerPC/PowerPC.h
+++ b/Source/Core/Core/PowerPC/PowerPC.h
@@ -54,7 +54,7 @@ struct TLBEntry
   u32 tag[TLB_WAYS] = {INVALID_TAG, INVALID_TAG};
   u32 paddr[TLB_WAYS] = {};
   u32 pte[TLB_WAYS] = {};
-  u8 recent = 0;
+  u32 recent = 0;
 };
 
 struct PairedSingle