encourage inlining of some PagedMemoryRange*Enumerator members

This commit is contained in:
Jim Horvath 2024-02-18 21:55:04 -05:00
commit 79aeb83a69
2 changed files with 18 additions and 3 deletions

View file

@ -1,4 +1,5 @@
using System; using System;
using System.Runtime.CompilerServices;
namespace Ryujinx.Memory.Range namespace Ryujinx.Memory.Range
{ {
@ -12,7 +13,11 @@ namespace Ryujinx.Memory.Range
_enumerator = new PagedMemoryRangeEnumerator(startAddress, size, pageSize, mapAddress); _enumerator = new PagedMemoryRangeEnumerator(startAddress, size, pageSize, mapAddress);
} }
public readonly MemoryRange Current => _current!.Value; public readonly MemoryRange Current
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get => _current!.Value;
}
/// <summary> /// <summary>
/// Returning this through a GetEnumerator() call allows it to be used directly in a foreach loop. /// Returning this through a GetEnumerator() call allows it to be used directly in a foreach loop.

View file

@ -1,4 +1,5 @@
using System; using System;
using System.Runtime.CompilerServices;
namespace Ryujinx.Memory.Range namespace Ryujinx.Memory.Range
{ {
@ -22,9 +23,17 @@ namespace Ryujinx.Memory.Range
_offset = 0; _offset = 0;
} }
public readonly MemoryRange Current => _current!.Value; public readonly MemoryRange Current
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get => _current!.Value;
}
internal readonly bool HasCurrent => _current.HasValue; internal readonly bool HasCurrent
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get => _current.HasValue;
}
/// <summary> /// <summary>
/// Returning this through a GetEnumerator() call allows it to be used directly in a foreach loop. /// Returning this through a GetEnumerator() call allows it to be used directly in a foreach loop.
@ -59,6 +68,7 @@ namespace Ryujinx.Memory.Range
return false; return false;
} }
[MethodImpl(MethodImplOptions.AggressiveInlining)]
private void SetCurrent(ulong address, int size) private void SetCurrent(ulong address, int size)
{ {
_current = new MemoryRange(address, (ulong)size); _current = new MemoryRange(address, (ulong)size);