AK: Add {Little,Big}Endian::bytes()

This allows you to easily convert those types to ReadonlyBytes.
This commit is contained in:
Sönke Holz
2026-02-15 12:32:07 +01:00
committed by Sönke Holz
parent e06f968199
commit c07b918aee

View File

@@ -65,6 +65,8 @@ public:
constexpr operator T() const { return convert_between_host_and_little_endian(m_value); }
constexpr ReadonlyBytes bytes() const { return { this, sizeof(*this) }; }
private:
T m_value { 0 };
};
@@ -81,6 +83,8 @@ public:
constexpr operator T() const { return convert_between_host_and_big_endian(m_value); }
constexpr ReadonlyBytes bytes() const { return { this, sizeof(*this) }; }
private:
T m_value { 0 };
};