mirror of
https://github.com/matrix-construct/construct
synced 2025-01-13 08:23:56 +01:00
ircd::allocator: Add state::available(n) query.
This commit is contained in:
parent
2424208a01
commit
0a9fdda893
2 changed files with 8 additions and 0 deletions
|
@ -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);
|
||||
|
||||
|
|
|
@ -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
|
||||
//
|
||||
|
|
Loading…
Reference in a new issue