mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 05:37:34 +00:00
Kernel: Make VirtualAddress methods constexpr
In order to use VirtualAddresses as compile time constants in the AddressSanitizer implementation, we need to be able to use these methods in constexpr functions / variable initializations.
This commit is contained in:
parent
665e848576
commit
9acf449ced
1 changed files with 5 additions and 5 deletions
|
@ -12,7 +12,7 @@
|
||||||
class VirtualAddress {
|
class VirtualAddress {
|
||||||
public:
|
public:
|
||||||
VirtualAddress() = default;
|
VirtualAddress() = default;
|
||||||
explicit VirtualAddress(FlatPtr address)
|
constexpr explicit VirtualAddress(FlatPtr address)
|
||||||
: m_address(address)
|
: m_address(address)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -22,11 +22,11 @@ public:
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]] bool is_null() const { return m_address == 0; }
|
[[nodiscard]] constexpr bool is_null() const { return m_address == 0; }
|
||||||
[[nodiscard]] bool is_page_aligned() const { return (m_address & 0xfff) == 0; }
|
[[nodiscard]] constexpr bool is_page_aligned() const { return (m_address & 0xfff) == 0; }
|
||||||
|
|
||||||
[[nodiscard]] VirtualAddress offset(FlatPtr o) const { return VirtualAddress(m_address + o); }
|
[[nodiscard]] constexpr VirtualAddress offset(FlatPtr o) const { return VirtualAddress(m_address + o); }
|
||||||
[[nodiscard]] FlatPtr get() const { return m_address; }
|
[[nodiscard]] constexpr FlatPtr get() const { return m_address; }
|
||||||
void set(FlatPtr address) { m_address = address; }
|
void set(FlatPtr address) { m_address = address; }
|
||||||
void mask(FlatPtr m) { m_address &= m; }
|
void mask(FlatPtr m) { m_address &= m; }
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue