diff options
author | Alex Barney <thealexbarney@gmail.com> | 2018-12-06 05:16:24 -0600 |
---|---|---|
committer | gdkchan <gab.dark.100@gmail.com> | 2018-12-06 09:16:24 -0200 |
commit | fb1d9493a3d43f2b86c551682586905a1f0e9ea7 (patch) | |
tree | d842685ff5bdd45d11d94bd1a45a002b9d532fe7 /Ryujinx.HLE/HOS/Services/Nv/NvHostCtrl/NvHostSyncPt.cs | |
parent | 3615a70cae3f89197fe185dfc5d0a47fa42151d9 (diff) |
Adjust naming conventions and general refactoring in HLE Project (#527)
* Rename enum fields
* Naming conventions
* Remove unneeded ".this"
* Remove unneeded semicolons
* Remove unused Usings
* Don't use var
* Remove unneeded enum underlying types
* Explicitly label class visibility
* Remove unneeded @ prefixes
* Remove unneeded commas
* Remove unneeded if expressions
* Method doesn't use unsafe code
* Remove unneeded casts
* Initialized objects don't need an empty constructor
* Remove settings from DotSettings
* Revert "Explicitly label class visibility"
This reverts commit ad5eb5787cc5b27a4631cd46ef5f551c4ae95e51.
* Small changes
* Revert external enum renaming
* Changes from feedback
* Apply previous refactorings to the merged code
Diffstat (limited to 'Ryujinx.HLE/HOS/Services/Nv/NvHostCtrl/NvHostSyncPt.cs')
-rw-r--r-- | Ryujinx.HLE/HOS/Services/Nv/NvHostCtrl/NvHostSyncPt.cs | 76 |
1 files changed, 38 insertions, 38 deletions
diff --git a/Ryujinx.HLE/HOS/Services/Nv/NvHostCtrl/NvHostSyncPt.cs b/Ryujinx.HLE/HOS/Services/Nv/NvHostCtrl/NvHostSyncPt.cs index 9ffa93f2..d27f7c53 100644 --- a/Ryujinx.HLE/HOS/Services/Nv/NvHostCtrl/NvHostSyncPt.cs +++ b/Ryujinx.HLE/HOS/Services/Nv/NvHostCtrl/NvHostSyncPt.cs @@ -9,98 +9,98 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvHostCtrl { public const int SyncptsCount = 192; - private int[] CounterMin; - private int[] CounterMax; + private int[] _counterMin; + private int[] _counterMax; - private long EventMask; + private long _eventMask; - private ConcurrentDictionary<EventWaitHandle, int> Waiters; + private ConcurrentDictionary<EventWaitHandle, int> _waiters; public NvHostSyncpt() { - CounterMin = new int[SyncptsCount]; - CounterMax = new int[SyncptsCount]; + _counterMin = new int[SyncptsCount]; + _counterMax = new int[SyncptsCount]; - Waiters = new ConcurrentDictionary<EventWaitHandle, int>(); + _waiters = new ConcurrentDictionary<EventWaitHandle, int>(); } - public int GetMin(int Id) + public int GetMin(int id) { - return CounterMin[Id]; + return _counterMin[id]; } - public int GetMax(int Id) + public int GetMax(int id) { - return CounterMax[Id]; + return _counterMax[id]; } - public int Increment(int Id) + public int Increment(int id) { - if (((EventMask >> Id) & 1) != 0) + if (((_eventMask >> id) & 1) != 0) { - Interlocked.Increment(ref CounterMax[Id]); + Interlocked.Increment(ref _counterMax[id]); } - return IncrementMin(Id); + return IncrementMin(id); } - public int IncrementMin(int Id) + public int IncrementMin(int id) { - int Value = Interlocked.Increment(ref CounterMin[Id]); + int value = Interlocked.Increment(ref _counterMin[id]); - WakeUpWaiters(Id, Value); + WakeUpWaiters(id, value); - return Value; + return value; } - public int IncrementMax(int Id) + public int IncrementMax(int id) { - return Interlocked.Increment(ref CounterMax[Id]); + return Interlocked.Increment(ref _counterMax[id]); } - public void AddWaiter(int Threshold, EventWaitHandle WaitEvent) + public void AddWaiter(int threshold, EventWaitHandle waitEvent) { - if (!Waiters.TryAdd(WaitEvent, Threshold)) + if (!_waiters.TryAdd(waitEvent, threshold)) { throw new InvalidOperationException(); } } - public bool RemoveWaiter(EventWaitHandle WaitEvent) + public bool RemoveWaiter(EventWaitHandle waitEvent) { - return Waiters.TryRemove(WaitEvent, out _); + return _waiters.TryRemove(waitEvent, out _); } - private void WakeUpWaiters(int Id, int NewValue) + private void WakeUpWaiters(int id, int newValue) { - foreach (KeyValuePair<EventWaitHandle, int> KV in Waiters) + foreach (KeyValuePair<EventWaitHandle, int> kv in _waiters) { - if (MinCompare(Id, NewValue, CounterMax[Id], KV.Value)) + if (MinCompare(id, newValue, _counterMax[id], kv.Value)) { - KV.Key.Set(); + kv.Key.Set(); - Waiters.TryRemove(KV.Key, out _); + _waiters.TryRemove(kv.Key, out _); } } } - public bool MinCompare(int Id, int Threshold) + public bool MinCompare(int id, int threshold) { - return MinCompare(Id, CounterMin[Id], CounterMax[Id], Threshold); + return MinCompare(id, _counterMin[id], _counterMax[id], threshold); } - private bool MinCompare(int Id, int Min, int Max, int Threshold) + private bool MinCompare(int id, int min, int max, int threshold) { - int MinDiff = Min - Threshold; - int MaxDiff = Max - Threshold; + int minDiff = min - threshold; + int maxDiff = max - threshold; - if (((EventMask >> Id) & 1) != 0) + if (((_eventMask >> id) & 1) != 0) { - return MinDiff >= 0; + return minDiff >= 0; } else { - return (uint)MaxDiff >= (uint)MinDiff; + return (uint)maxDiff >= (uint)minDiff; } } } |