A bit of Range cleanup

This commit is contained in:
YoshiRulz 2020-06-21 06:05:21 +10:00 committed by zeromus
parent f37b74c4ba
commit abcf91f7d6
4 changed files with 4 additions and 4 deletions

View File

@ -559,7 +559,7 @@ namespace BizHawk.Client.EmuHawk
if (end <= start) if (end <= start)
return dict; return dict;
var range = new MutableRange<long>(start, end - 1); var range = start.RangeToExclusive(end);
switch (dataSize) switch (dataSize)
{ {

View File

@ -20,7 +20,7 @@ namespace BizHawk.Common
private (T Start, T EndInclusive) r; private (T Start, T EndInclusive) r;
/// <inheritdoc cref="Overwrite"/> /// <inheritdoc cref="Overwrite"/>
public MutableRange(T start, T endInclusive) => Overwrite(start, endInclusive); internal MutableRange(T start, T endInclusive) => Overwrite(start, endInclusive);
/// <exception cref="ArgumentOutOfRangeException">(from setter) <paramref name="value"/> > <see cref="EndInclusive"/></exception> /// <exception cref="ArgumentOutOfRangeException">(from setter) <paramref name="value"/> > <see cref="EndInclusive"/></exception>
public T Start public T Start

View File

@ -60,7 +60,7 @@ namespace BizHawk.Emulation.Common
// TODO: Memory domain doesn't have the overload we need :( // TODO: Memory domain doesn't have the overload we need :(
var poop = new byte[count]; var poop = new byte[count];
// TODO: Range has the wrong end value // TODO: Range has the wrong end value
_d.BulkPeekByte(new MutableRange<long>(Position, Position + count - 1), poop); _d.BulkPeekByte(Position.RangeToExclusive(Position + count), poop);
Array.Copy(poop, 0, buffer, offset, count); Array.Copy(poop, 0, buffer, offset, count);
Position += count; Position += count;
return count; return count;

View File

@ -357,7 +357,7 @@ namespace BizHawk.Emulation.Cores.PCEngine
// clear inter-sprite priority buffer // clear inter-sprite priority buffer
Array.Clear(InterSpritePriorityBuffer, 0, FrameWidth); Array.Clear(InterSpritePriorityBuffer, 0, FrameWidth);
var testRange = new MutableRange<int>(0, vdc.ActiveLine + 1); var testRange = 0.MutableRangeTo(vdc.ActiveLine + 1);
for (int i = 0; i < 64; i++) for (int i = 0; i < 64; i++)
{ {
int y = (vdc.SpriteAttributeTable[(i * 4) + 0] & 1023) - 64; int y = (vdc.SpriteAttributeTable[(i * 4) + 0] & 1023) - 64;