From 30002c2ccbe012a629adf933ee314a57a69fac4e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?kleines=20Filmr=C3=B6llchen?= Date: Tue, 15 Feb 2022 00:35:20 +0100 Subject: [PATCH] AK: Add bit shift to FixedPoint --- AK/FixedPoint.h | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/AK/FixedPoint.h b/AK/FixedPoint.h index 7f87935eb8..d3dc17b768 100644 --- a/AK/FixedPoint.h +++ b/AK/FixedPoint.h @@ -179,6 +179,16 @@ public: { return create_raw(m_value / other); } + template + constexpr This operator>>(I other) const + { + return create_raw(m_value >> other); + } + template + constexpr This operator<<(I other) const + { + return create_raw(m_value << other); + } This& operator+=(This const& other) { @@ -239,6 +249,18 @@ public: m_value /= other; return *this; } + template + This& operator>>=(I other) + { + m_value >>= other; + return *this; + } + template + This& operator<<=(I other) + { + m_value <<= other; + return *this; + } bool operator==(This const& other) const { return raw() == other.raw(); } bool operator!=(This const& other) const { return raw() != other.raw(); }