0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-09-27 19:28:52 +02:00

ircd::allocator: Ensure consistent conversion here.

This commit is contained in:
Jason Volk 2019-03-26 11:34:01 -07:00
parent 92ebdd83a4
commit 9dac813278

View file

@ -222,7 +222,7 @@ struct ircd::allocator::fixed<T, SIZE>::allocator
allocate(std::nothrow_t, const size_type &n, const const_pointer &hint = nullptr)
{
const auto base(reinterpret_cast<pointer>(s->buf.data()));
const uint hintpos(hint? hint - base : -1);
const uint hintpos(hint? uintptr_t(hint - base) : uintptr_t(-1));
const pointer ret(base + s->state::allocate(std::nothrow, n, hintpos));
return s->in_range(ret)? ret : nullptr;
}
@ -232,7 +232,7 @@ struct ircd::allocator::fixed<T, SIZE>::allocator
allocate(const size_type &n, const const_pointer &hint = nullptr)
{
const auto base(reinterpret_cast<pointer>(s->buf.data()));
const uint hintpos(hint? hint - base : -1);
const uint hintpos(hint? uintptr_t(hint - base) : uintptr_t(-1));
return base + s->state::allocate(n, hintpos);
}