encourage inlining of some PagedMemoryRange*Enumerator members

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

View file

@ -1,4 +1,5 @@
using System;
using System.Runtime.CompilerServices;
namespace Ryujinx.Memory.Range
{
@ -12,7 +13,11 @@ namespace Ryujinx.Memory.Range
_enumerator = new PagedMemoryRangeEnumerator(startAddress, size, pageSize, mapAddress);
}
public readonly MemoryRange Current => _current!.Value;
public readonly MemoryRange Current
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get => _current!.Value;
}
/// <summary>
/// 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.Runtime.CompilerServices;
namespace Ryujinx.Memory.Range
{
@ -22,9 +23,17 @@ namespace Ryujinx.Memory.Range
_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>
/// 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;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
private void SetCurrent(ulong address, int size)
{
_current = new MemoryRange(address, (ulong)size);