From 9d82d27df2d28c96f854b050c65e58eb1a48a22d Mon Sep 17 00:00:00 2001
From: gdkchan <gab.dark.100@gmail.com>
Date: Tue, 16 Feb 2021 19:16:20 -0300
Subject: Fix memory tracking performance regression (#2026)

* Fix memory tracking performance regression

* Set PTC version
---
 ARMeilleure/Instructions/InstEmitMemoryHelper.cs | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

(limited to 'ARMeilleure/Instructions/InstEmitMemoryHelper.cs')

diff --git a/ARMeilleure/Instructions/InstEmitMemoryHelper.cs b/ARMeilleure/Instructions/InstEmitMemoryHelper.cs
index cb4fae8f..2d7b6799 100644
--- a/ARMeilleure/Instructions/InstEmitMemoryHelper.cs
+++ b/ARMeilleure/Instructions/InstEmitMemoryHelper.cs
@@ -334,14 +334,14 @@ namespace ARMeilleure.Instructions
             {
                 if (write)
                 {
-                    pte = context.ShiftLeft(pte, Const(1));
                     context.BranchIf(lblSlowPath, pte, Const(0L), Comparison.LessOrEqual);
-                    pte = context.ShiftRightUI(pte, Const(1));
+                    pte = context.BitwiseAnd(pte, Const(0xffffffffffffUL)); // Ignore any software protection bits. (they are still used by C# memory access)
                 }
                 else
                 {
+                    pte = context.ShiftLeft(pte, Const(1));
                     context.BranchIf(lblSlowPath, pte, Const(0L), Comparison.LessOrEqual);
-                    pte = context.BitwiseAnd(pte, Const(0xffffffffffffUL)); // Ignore any software protection bits. (they are still used by C# memory access)
+                    pte = context.ShiftRightUI(pte, Const(1));
                 }
             }
             else
-- 
cgit v1.2.3-70-g09d2