2018-12-18 06:33:36 +01:00
|
|
|
namespace Ryujinx.HLE.HOS.Kernel.Memory
|
2018-11-28 23:18:09 +01:00
|
|
|
{
|
|
|
|
class KMemoryBlockAllocator
|
|
|
|
{
|
2018-12-06 12:16:24 +01:00
|
|
|
private ulong _capacityElements;
|
2018-11-28 23:18:09 +01:00
|
|
|
|
|
|
|
public int Count { get; set; }
|
|
|
|
|
2018-12-06 12:16:24 +01:00
|
|
|
public KMemoryBlockAllocator(ulong capacityElements)
|
2018-11-28 23:18:09 +01:00
|
|
|
{
|
2018-12-06 12:16:24 +01:00
|
|
|
_capacityElements = capacityElements;
|
2018-11-28 23:18:09 +01:00
|
|
|
}
|
|
|
|
|
2018-12-06 12:16:24 +01:00
|
|
|
public bool CanAllocate(int count)
|
2018-11-28 23:18:09 +01:00
|
|
|
{
|
2018-12-06 12:16:24 +01:00
|
|
|
return (ulong)(Count + count) <= _capacityElements;
|
2018-11-28 23:18:09 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|