memory: make assertions lenient towards nullptr

This commit is contained in:
Hyper 2024-11-25 04:37:44 +00:00
parent be2ebebfda
commit 5b4b4b9fef

View file

@ -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);
} }
}; };