0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-06-11 14:38:57 +02:00

ircd::allocator: Add state::available(n) query.

This commit is contained in:
Jason Volk 2018-08-25 18:46:54 -07:00
parent 2424208a01
commit 0a9fdda893
2 changed files with 8 additions and 0 deletions

View file

@ -89,6 +89,7 @@ struct ircd::allocator::state
uint next(const size_t &n) const;
public:
bool available(const size_t &n = 1) const;
void deallocate(const uint &p, const size_t &n);
uint allocate(const size_t &n, const uint &hint = -1);

View file

@ -127,6 +127,13 @@ const
return ret - n;
}
bool
ircd::allocator::state::available(const size_t &n)
const
{
return this->next(n) < size;
}
//
// allocator::profile
//