Kaynağa Gözat

misc: chore: [ci skip] Use explicit types & target-typed new

Evan Husted 1 yıl önce
ebeveyn
işleme
6ab899f621

+ 3 - 3
src/ARMeilleure/Translation/Cache/JitCache.cs

@@ -52,7 +52,7 @@ namespace ARMeilleure.Translation.Cache
                     return;
                 }
 
-                var firstRegion = new ReservedRegion(allocator, CacheSize);
+                ReservedRegion firstRegion = new(allocator, CacheSize);
                 _jitRegions.Add(firstRegion);
                 _activeRegionIndex = 0;
 
@@ -124,7 +124,7 @@ namespace ARMeilleure.Translation.Cache
             {
                 Debug.Assert(_initialized);
 
-                foreach (var region in _jitRegions)
+                foreach (ReservedRegion region in _jitRegions)
                 {
                     if (pointer.ToInt64() < region.Pointer.ToInt64() ||
                         pointer.ToInt64() >= (region.Pointer + CacheSize).ToInt64())
@@ -224,7 +224,7 @@ namespace ARMeilleure.Translation.Cache
         {
             lock (_lock)
             {
-                foreach (var region in _jitRegions)
+                foreach (ReservedRegion _ in _jitRegions)
                 {
                     int index = _cacheEntries.BinarySearch(new CacheEntry(offset, 0, default));
 

+ 7 - 9
src/ARMeilleure/Translation/PTC/PtcProfiler.cs

@@ -144,17 +144,15 @@ namespace ARMeilleure.Translation.PTC
 
         public List<ulong> GetBlacklistedFunctions()
         {
-            List<ulong> funcs = new List<ulong>();
+            List<ulong> funcs = [];
 
-            foreach (var profiledFunc in ProfiledFuncs)
+            foreach ((ulong ptr, FuncProfile funcProfile) in ProfiledFuncs)
             {
-                if (profiledFunc.Value.Blacklist)
-                {
-                    if (!funcs.Contains(profiledFunc.Key))
-                    {
-                        funcs.Add(profiledFunc.Key);
-                    }
-                }
+                if (!funcProfile.Blacklist)
+                    continue;
+
+                if (!funcs.Contains(ptr)) 
+                    funcs.Add(ptr);
             }
 
             return funcs;

+ 3 - 3
src/Ryujinx.Cpu/LightningJit/Cache/JitCache.cs

@@ -48,7 +48,7 @@ namespace Ryujinx.Cpu.LightningJit.Cache
                     return;
                 }
 
-                var firstRegion = new ReservedRegion(allocator, CacheSize);
+                ReservedRegion firstRegion = new(allocator, CacheSize);
                 _jitRegions.Add(firstRegion);
                 _activeRegionIndex = 0;
 
@@ -104,7 +104,7 @@ namespace Ryujinx.Cpu.LightningJit.Cache
             {
                 Debug.Assert(_initialized);
 
-                foreach (var region in _jitRegions)
+                foreach (ReservedRegion region in _jitRegions)
                 {
                     if (pointer.ToInt64() < region.Pointer.ToInt64() ||
                         pointer.ToInt64() >= (region.Pointer + CacheSize).ToInt64())
@@ -160,7 +160,7 @@ namespace Ryujinx.Cpu.LightningJit.Cache
             }
 
             int exhaustedRegion = _activeRegionIndex;
-            var newRegion = new ReservedRegion(_jitRegions[0].Allocator, CacheSize);
+            ReservedRegion newRegion = new(_jitRegions[0].Allocator, CacheSize);
             _jitRegions.Add(newRegion);
             _activeRegionIndex = _jitRegions.Count - 1;
             

+ 2 - 2
src/Ryujinx/Utilities/PlayReport/Specs.cs

@@ -152,7 +152,7 @@ namespace Ryujinx.Ava.Utilities.PlayReport
         public override bool GetData(Horizon.Prepo.Types.PlayReport playReport, out object result)
         {
             List<MessagePackObject> packedObjects = [];
-            foreach (var reportKey in ReportKeys)
+            foreach (string reportKey in ReportKeys)
             {
                 if (!playReport.ReportData.AsDictionary().TryGetValue(reportKey, out MessagePackObject valuePackObject))
                 {
@@ -176,7 +176,7 @@ namespace Ryujinx.Ava.Utilities.PlayReport
         public override bool GetData(Horizon.Prepo.Types.PlayReport playReport, out object result)
         {
             Dictionary<string, MessagePackObject> packedObjects = [];
-            foreach (var reportKey in ReportKeys)
+            foreach (string reportKey in ReportKeys)
             {
                 if (!playReport.ReportData.AsDictionary().TryGetValue(reportKey, out MessagePackObject valuePackObject))
                     continue;