Inline and simplify all `Range<float>` usage

This commit is contained in:
YoshiRulz 2024-07-10 12:21:25 +10:00
parent e44810a725
commit ccfd702484
No known key found for this signature in database
GPG Key ID: C4DE31C245353FB7
2 changed files with 2 additions and 8 deletions

View File

@ -230,8 +230,7 @@ namespace BizHawk.Client.EmuHawk
// reset way-out-of-range values
if (diff > 1.0f)
diff = 1.0f;
if (!(-1.0f).RangeTo(1.0f).Contains(error))
error = 0.0f;
if (Math.Abs(error) > 1.0f) error = 0.0f;
if (diffUnthrottled > 1.0f)
diffUnthrottled = desiredspf;

View File

@ -8,7 +8,6 @@ using System.Xml.XPath;
using System.Xml.Linq;
using BizHawk.Client.Common;
using BizHawk.Common;
using BizHawk.Emulation.Cores.Nintendo.NES;
using BizHawk.Emulation.Common;
@ -63,11 +62,7 @@ namespace BizHawk.Client.EmuHawk
float a = FreqTable[i - 1];
float b = FreqTable[i];
float c = FreqTable[i + 1];
var range = ((a + b) / 2).RangeTo((b + c) / 2);
if (range.Contains(freq))
{
return i - 1;
}
if ((a + b) / 2 <= freq && freq <= (b + c) / 2) return i - 1;
}
return 95; // I guess?