use actual Clamp()

This commit is contained in:
vadosnaprimer 2017-12-01 18:19:29 +03:00
parent cea50c1ab1
commit fcb7588724
1 changed files with 3 additions and 4 deletions

View File

@ -3,6 +3,7 @@ using System.Windows.Forms;
using BizHawk.Emulation.Common;
using BizHawk.Client.Common;
using BizHawk.Common.NumberExtensions;
namespace BizHawk.Client.EmuHawk
{
@ -34,10 +35,8 @@ namespace BizHawk.Client.EmuHawk
MemStateGapDividerNumeric.Maximum = Statable.SaveStateBinary().Length / 1024 / 2 + 1;
MemStateGapDividerNumeric.Minimum = Statable.SaveStateBinary().Length / 1024 / 16;
// props to .net for this amazing Clamp() implementation
MemStateGapDividerNumeric.Value = Math.Min(Math.Max(_settings.MemStateGapDivider,
MemStateGapDividerNumeric.Minimum), MemStateGapDividerNumeric.Maximum);
MemStateGapDividerNumeric.Value = NumberExtensions.Clamp(_settings.MemStateGapDivider,
MemStateGapDividerNumeric.Minimum, MemStateGapDividerNumeric.Maximum);
FileStateGapNumeric.Value = _settings.FileStateGap;
SavestateSizeLabel.Text = Math.Round(_stateSizeMb, 2).ToString() + " MB";