Add missing "yield return" (#424)

This commit is contained in:
Marco Carvalho 2024-12-22 02:28:31 -03:00 committed by GitHub
parent 67ec10feea
commit decd37ce6d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 54 additions and 95 deletions

View file

@ -168,16 +168,14 @@ namespace Ryujinx.Graphics.Vulkan
return BinarySearch(list, offset, size) >= 0;
}
public readonly List<Range> FindOverlaps(int offset, int size)
public readonly IEnumerable<Range> FindOverlaps(int offset, int size)
{
var list = _ranges;
if (list == null)
{
return null;
yield break;
}
List<Range> result = null;
int index = BinarySearch(list, offset, size);
if (index >= 0)
@ -189,12 +187,10 @@ namespace Ryujinx.Graphics.Vulkan
do
{
(result ??= new List<Range>()).Add(list[index++]);
yield return list[index++];
}
while (index < list.Count && list[index].OverlapsWith(offset, size));
}
return result;
}
private static int BinarySearch(List<Range> list, int offset, int size)