mirror of
https://github.com/hedge-dev/UnleashedRecomp.git
synced 2026-04-27 21:01:37 +00:00
memory: make assertions lenient towards nullptr
This commit is contained in:
parent
be2ebebfda
commit
5b4b4b9fef
1 changed files with 6 additions and 2 deletions
|
|
@ -16,13 +16,17 @@ public:
|
||||||
|
|
||||||
void* Translate(size_t offset) const noexcept
|
void* Translate(size_t offset) const noexcept
|
||||||
{
|
{
|
||||||
assert(offset < 0x100000000ull);
|
if (offset)
|
||||||
|
assert(offset < 0x100000000ull);
|
||||||
|
|
||||||
return base + offset;
|
return base + offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t MapVirtual(void* host) const noexcept
|
uint32_t MapVirtual(void* host) const noexcept
|
||||||
{
|
{
|
||||||
assert(host >= base && host < (base + size));
|
if (host)
|
||||||
|
assert(host >= base && host < (base + size));
|
||||||
|
|
||||||
return static_cast<uint32_t>(static_cast<char*>(host) - base);
|
return static_cast<uint32_t>(static_cast<char*>(host) - base);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue