1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 10:17:35 +00:00

Kernel: Remove some unnecessary casts to uintptr_t

VirtualAddress is constructible from uintptr_t and const void*.
PhysicalAddress is constructible from uintptr_t but not const void*.
This commit is contained in:
Andreas Kling 2020-01-20 13:06:41 +01:00
parent a246e9cd7e
commit 4b7a89911c
7 changed files with 41 additions and 31 deletions

View file

@ -45,7 +45,7 @@ AnonymousVMObject::AnonymousVMObject(size_t size)
AnonymousVMObject::AnonymousVMObject(PhysicalAddress paddr, size_t size)
: VMObject(size)
{
ASSERT(paddr.page_base() == paddr.get());
ASSERT(paddr.page_base() == paddr);
for (size_t i = 0; i < page_count(); ++i)
physical_pages()[i] = PhysicalPage::create(paddr.offset(i * PAGE_SIZE), false, false);
}

View file

@ -47,7 +47,7 @@ public:
u8* as_ptr() { return reinterpret_cast<u8*>(m_address); }
const u8* as_ptr() const { return reinterpret_cast<const u8*>(m_address); }
uintptr_t page_base() const { return m_address & 0xfffff000; }
PhysicalAddress page_base() const { return PhysicalAddress(m_address & 0xfffff000); }
bool operator==(const PhysicalAddress& other) const { return m_address == other.m_address; }
bool operator!=(const PhysicalAddress& other) const { return m_address != other.m_address; }