mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-02 22:30:31 +00:00
Kernel: Prevent confusing silent misuse of PCI::Address
This commit is contained in:
parent
b4f26c2b31
commit
9a0cd9a50d
Notes:
sideshowbarker
2024-07-19 03:17:56 +09:00
Author: https://github.com/BenWiederhake
Commit: 9a0cd9a50d
Pull-request: https://github.com/SerenityOS/serenity/pull/3262
1 changed files with 8 additions and 1 deletions
|
@ -89,7 +89,7 @@ inline const LogStream& operator<<(const LogStream& stream, const ID value)
|
||||||
}
|
}
|
||||||
struct Address {
|
struct Address {
|
||||||
public:
|
public:
|
||||||
Address() {}
|
Address() { }
|
||||||
Address(u16 seg)
|
Address(u16 seg)
|
||||||
: m_seg(seg)
|
: m_seg(seg)
|
||||||
, m_bus(0)
|
, m_bus(0)
|
||||||
|
@ -116,6 +116,13 @@ public:
|
||||||
bool is_null() const { return !m_bus && !m_slot && !m_function; }
|
bool is_null() const { return !m_bus && !m_slot && !m_function; }
|
||||||
operator bool() const { return !is_null(); }
|
operator bool() const { return !is_null(); }
|
||||||
|
|
||||||
|
// Disable default implementations that would use surprising integer promotion.
|
||||||
|
bool operator==(const Address&) const = delete;
|
||||||
|
bool operator<=(const Address&) const = delete;
|
||||||
|
bool operator>=(const Address&) const = delete;
|
||||||
|
bool operator<(const Address&) const = delete;
|
||||||
|
bool operator>(const Address&) const = delete;
|
||||||
|
|
||||||
u16 seg() const { return m_seg; }
|
u16 seg() const { return m_seg; }
|
||||||
u8 bus() const { return m_bus; }
|
u8 bus() const { return m_bus; }
|
||||||
u8 slot() const { return m_slot; }
|
u8 slot() const { return m_slot; }
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue