diff --git a/AK/FixedPoint.h b/AK/FixedPoint.h index 72d668f488b..a0316ff200e 100644 --- a/AK/FixedPoint.h +++ b/AK/FixedPoint.h @@ -226,8 +226,14 @@ public: } constexpr This operator/(This const& other) const { - // FIXME: Better rounding? - return create_raw((m_value / other.m_value) << (precision)); + // FIXME: Figure out a way to use more narrow types and avoid __int128 + using DivRes = Conditional; + + DivRes value = raw(); + value <<= precision; + value /= other.raw(); + + return create_raw(value); } template @@ -278,9 +284,7 @@ public: } This& operator/=(This const& other) { - // FIXME: See above - m_value /= other.raw(); - m_value <<= precision; + *this = *this / other; return *this; }