mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-16 11:48:36 +12:00
Idm: Minor assert fix
This commit is contained in:
parent
9344b21484
commit
1d4595a349
2 changed files with 4 additions and 8 deletions
|
@ -19,13 +19,9 @@ id_manager::id_map::pointer idm::allocate_id(const id_manager::id_key& info, u32
|
||||||
{
|
{
|
||||||
// Try to emplace back
|
// Try to emplace back
|
||||||
const u32 _next = base + step * ::size32(vec);
|
const u32 _next = base + step * ::size32(vec);
|
||||||
|
g_id = _next;
|
||||||
if (_next >= base && _next < base + step * count)
|
vec.emplace_back(id_manager::id_key(_next, info.type()), nullptr);
|
||||||
{
|
return &vec.back();
|
||||||
g_id = _next;
|
|
||||||
vec.emplace_back(id_manager::id_key(_next, info.type()), nullptr);
|
|
||||||
return &vec.back();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check all IDs starting from "next id" (TODO)
|
// Check all IDs starting from "next id" (TODO)
|
||||||
|
|
|
@ -33,7 +33,7 @@ namespace id_manager
|
||||||
static const u32 invalid = -+!base;
|
static const u32 invalid = -+!base;
|
||||||
|
|
||||||
// Note: full 32 bits range cannot be used at current implementation
|
// Note: full 32 bits range cannot be used at current implementation
|
||||||
static_assert(count > 0 && step > 0 && u64{step} * count + base < u64{UINT32_MAX} + (base != 0 ? 1 : 0), "ID traits: invalid object range");
|
static_assert(count && step && u64{step} * (count - 1) + base < u64{UINT32_MAX} + (base != 0 ? 1 : 0), "ID traits: invalid object range");
|
||||||
};
|
};
|
||||||
|
|
||||||
// Correct usage testing
|
// Correct usage testing
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue